ProgrammingVery hard

A swap-based selection sort is run on the records (A,2), (B,2), (C,1) using the key only. What is the final order?

  1. A. C, B, A
  2. B. C, A, B
  3. C. A, B, C
  4. D. B, A, C

Correct answer: A. C, B, A

The first swap moves C to the front and sends A to the end position of the pass, so B and A end up reversed. Selection sort with swaps is not stable.

More C Programming questions

Exams that ask this topic