- Introduction to Challenges
- Insertion Sort 1
- Insertion Sort Itself
- Correctness and the Loop Invariant
- Running Time
-
Counting Sort 1 - Simple Counting Sort
- Prepare for Full Counting Sort
- The Full Counting Sort
-
QuickSort1 - Simple Quick Sort
- Quick-Sort Advanced
- Quick Sort Running Time
Input Format for standard Sorting Challenges:
- t - the number of test cases
- s - the size of the array
- ar - the list of integers
Counting Sort 1
Collapse Content
Show Content
A comparison sorting algorithm cannot sort in faster than n*log(n) time on average. However, for certain types of input, it is more efficient to use a different type of sorting algorithm, which will make it possible to sort lists even in linear time.
These challenges will cover Counting Sort, a fast way to sort lists where the elements have a small number of possible values, such as integers within a certain range. We will start with an easy task - counting.
Click for More
Challenge
Output the number of times each value appears.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.