SSVISUAL.COM
function selection_sort(list):
FOR i = 1 to n - 1
min = i
FOR j = i+1 to n
IF list[j] < list[min] THEN
min = j;
END IF
END for
IF indexMin != i THEN
swap list[min] and list[i]
END IF
END FOR
END function
Current Index:
Current Min Value:
Cyan indicates the current minimum value.
Yellow indicates the current index.