Help Please with selection sort

solved ty!
Last edited on
1
2
arr[minValue] = arr[startScan];
minIndex = minValue;


You are not swapping correctly. Change this to:
1
2
arr[minIndex] = arr[startScan]; // location minIndex now has the value that startScan had.
arr[startScan] = minValue; // location startScan now has the value that minIndex had (minValue) 


EDIT: Comments added
Last edited on
tys so much!
@TC: So what happened to the code that was solved?
Topic archived. No new replies allowed.