Skills101
← All practice quizzes

Quiz: Counting Sort and Custom Sorting

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Sort without comparisons in O(n + k), understand what a stable sort is and why it matters, and sort by your own rules with key functions in Python and comparators in Java.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    print(sorted(["bb", "a", "ccc", "dd"], key=len))
    
  2. Question 2

    What is the time complexity of counting sort for n numbers in the range 0..k?

  3. Question 3

    When is counting sort a BAD idea?

  4. Question 4

    A stable sort orders [("A", 2), ("B", 1), ("C", 2)] by the number. What is the result?

  5. Question 5

    Which Python key sorts students by marks high to low, then by name A to Z?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?24 students have taken today’s challengeTake today’s challenge →