ProgrammingHard

Records are counted into buckets by key 0 to 2 in a stable counting sort. Input: Ann 2, Bob 0, Cy 2, Dee 1, Eve 0. What is the output order of names?

  1. A. Bob Eve Dee Ann Cy
  2. B. Ann Cy Dee Bob Eve
  3. C. Ann Cy Bob Eve Dee
  4. D. Bob Ann Eve Cy Dee

Correct answer: A. Bob Eve Dee Ann Cy

A stable counting sort writes the records with key 0 first, then key 1, then key 2, each group in input order. Bob precedes Eve, and Ann precedes Cy.

More C Programming questions

Exams that ask this topic