ProgrammingModerate

Keys {4, 7, 2, 9, 6, 1} are split into the even keys first and then the odd keys, keeping each group in input order. What is the result?

  1. A. 2 4 6 1 7 9
  2. B. 4 2 6 7 9 1
  3. C. 4 7 2 9 6 1
  4. D. 2 4 6 7 9 1

Correct answer: B. 4 2 6 7 9 1

A stable partition keeps the relative order inside each group. The evens 4, 2, 6 come first, then the odds 7, 9, 1.

More C Programming questions

Exams that ask this topic