Waste less time on Facebook — follow Brilliant.
Back to all chapters

Sorting Algorithms

Highly-organized data can be critical for many algorithms, and often you want your data ordered from least to greatest. The art of getting your data in order is trickier than you might think!

Counting Sort


Let \(n\) be the size of the input array and let \(V_{max}\) and \(V_{min}\) be the maximum and minimum elements within the input array respectively. Which of the following describes the correct space complexity of counting Sort?

Suppose we have an array with \(n\) elements and \(k\) is the size of the largest key. When would it be a bad idea to use counting sort to sort this array?

Details and assumptions

\(k = O(f(n))\) means \(k\) is bounded by the function \(f(n)\).

Assume we want to sort an array of ints. In which scenario is the use of counting sort the most sensible?


Problem Loading...

Note Loading...

Set Loading...