Hello,
I have this code that sorts strings but it does not sort them at all. I've been working on it for 2 hours already. Any help will be appreciated.
Thanks in advance :)
public void SelectionSort() {
for (int i = 0; i < myList.length - 1; i++) {
int smallist = getSmallest(i, myList.length-2);
swap(i, smallist);
}
}
private int getSmallest(int a, int b) {
int small = a;
for (int i = a+1; i < myList.length; i++) {
if (myList[i].compareTo(myList[a]) > 0) {
myList[a] = myList[i];
}
}
return small;
}