Data Structures & AlgorithmsHardGATE CS · Product placement

LSD radix sort (base 10, stable sort on each digit, units digit first) is applied to [134, 461, 324, 794, 742, 141, 668]. What is the list after the SECOND pass (tens digit)?

  1. A. [324, 134, 742, 141, 461, 668, 794]
  2. B. [461, 141, 742, 134, 324, 794, 668]
  3. C. [134, 141, 324, 461, 668, 742, 794]
  4. D. [324, 134, 141, 742, 461, 668, 794]

Correct answer: D. [324, 134, 141, 742, 461, 668, 794]

Pass 1 orders by units: [461, 141, 742, 134, 324, 794, 668]. Pass 2 stably orders by tens, so ties keep the units order: [324, 134, 141, 742, 461, 668, 794]. Sorting by tens alone, ignoring pass 1, loses that tie order.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic