The work of my algorithm ... almost ... for the reason the last two elements are in the wrong order after sorting. Also, the print statement is not showing me that Before sorting: After sorting: output my print statement first <0> FFF then only Because the value of capitals is lower than lowercase letters. first runs on the right.
public static SLL sort (SLL list) {SLLNode first = list.first; SLLNode second; While (first! = Null) {System.out.println (first.data); // if the first goes to the other side right then = first.succ; While (second! = Null) {if (second.data.compareTo (first.data) <0) {string temp = first.data; First.data = second.data; Second.data = temp; } Second = seconds succ; } First = first. Succ; } Return list; Before sorting:
FFF FAF Hi AAA by CAO
AAA by CIO FFF Hi FF
FF s
Comments
Post a Comment