Step 1/0
Custom array:
Complexity
Best:O(n+k)
Average:O(n+k)
Worst:O(n+k)
Space:O(k)
Description
Counts the occurrences of each value, then reconstructs the sorted array by iterating over the count array.
When to use
O(n+k) time for non-negative integers with small range k. Ideal for sorting integers, characters, or categorical data.