When the sorting algorithm below is performed on these three lists, which list will have preserved the relative order of the two equal 2s (\(2^+\) before \(2^*\))?
Start at the first element x[0]
and set this as the minimum: minIndex = 0, minValue = x[0]
Iterate through the rest of the list onebyone, replacing the minimum value as needed:
1 2 3 

Swap the final minimum element with the first element:
x[0], x[minIndex] = x[minIndex], x[0]
Move on to the next element x[1]
and repeat the entire process until you've started at every element in the list.
Problem Loading...
Note Loading...
Set Loading...