We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Counting Sort 1
- Discussions
Counting Sort 1
Counting Sort 1
Sort by
recency
|
590 Discussions
|
Please Login in order to post a comment
Python 3
I learnt about the Counter function in this page. I have been loving it since then.
c#.
for(int i = 0; i < arr.Count; i++) { sorted[arr[i]]++; }
Yeah took me to understand the size was fixed,
//JAVA public static List countingSort(List arr) {
}
}
javascript
This is not an efficient sorting method because we would have to compare all the values in order to find the largest value to create the frequency array. Which is basically what quicksort does. If you already know the largest value, like they gave us 100, Yep, then it is more efficient. Cool exercise, but it is kind of confusing.