previous | start | next

Self Check

  1. Why do we need the temp variable in the swap method? What would happen if you simply assigned a[i] to a[j] and a[j] to a[i]?
  2. What steps does the selection sort algorithm go through to sort the sequence 6 5 4 3 2 1?

previous | start | next