🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Counting Sort and Custom Sorting: all 13 questions

Quiz: Counting Sort and Custom Sorting · Question 13 of 13

Why can counting sort beat the O(n log n) limit for sorting?

Why can counting sort beat the O(n log n) limit for sorting?

  1. A.It uses a faster computer instruction
  2. B.It only sorts already sorted data
  3. C.It never compares two items; it counts values in a small known range, taking O(n + k)
  4. D.It skips half the items
Answer & explanation

Correct answer: It never compares two items; it counts values in a small known range, taking O(n + k)

The O(n log n) limit applies to sorts that work by comparing items. Counting sort uses the values as array indexes instead.

Can you get the rest right without peeking?

Take the timed Quiz: Counting Sort and Custom Sorting quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →