Recall & Review
beginner
What is the main idea behind the Counting Sort Algorithm?
Counting Sort counts how many times each number appears, then uses these counts to place numbers in the right order without comparing them directly.
Click to reveal answer
beginner
Which type of data is Counting Sort best suited for?
Counting Sort works best for sorting numbers that are small and within a known range, like ages from 0 to 100.
Click to reveal answer
intermediate
What is the time complexity of Counting Sort and why?
Counting Sort runs in O(n + k) time, where n is the number of elements and k is the range of input values, because it counts and places elements without comparisons.
Click to reveal answer
intermediate
How does Counting Sort ensure stability (keeping original order of equal elements)?
Counting Sort uses the counts to find exact positions for elements and places them from right to left, preserving the order of equal elements.
Click to reveal answer
intermediate
What is a limitation of Counting Sort compared to comparison-based sorts?
Counting Sort needs extra space proportional to the range of input values, so it is not efficient if the range is very large compared to the number of elements.
Click to reveal answer
What does Counting Sort use to sort elements?
✗ Incorrect
Counting Sort counts the frequency of each value to sort without direct comparisons.
Which of these is a requirement for Counting Sort to work efficiently?
✗ Incorrect
Counting Sort is efficient when input values are integers within a known small range.
What is the space complexity of Counting Sort?
✗ Incorrect
Counting Sort uses extra space proportional to the input size and the range of values.
How does Counting Sort place elements to maintain stability?
✗ Incorrect
Placing elements from right to left using counts keeps the original order of equal elements.
Counting Sort is NOT suitable when:
✗ Incorrect
A very large range makes Counting Sort use too much space and become inefficient.
Explain how Counting Sort works step-by-step on a small list of numbers.
Think about counting first, then using counts to find positions.
You got /4 concepts.
What are the advantages and disadvantages of Counting Sort compared to other sorting algorithms?
Consider speed and memory use.
You got /2 concepts.