Counting Sort Explained and Implemented with Examples in Java | Sorting Algorithms | Geekific

  Рет қаралды 14,179

Geekific

Geekific

Күн бұрын

Support us on Patreon: / geekific
GitHub Repository: github.com/geekific-official/...
Stay updated on our videos by subscribing to the channel and hitting the like button!
So far, we’ve been enriching our sorting algorithm series with algorithms that are able to sort any type of objects. But what if we needed to sort only integers, and in particular small ints, are these algorithms still the best choice out there? Or do we have more performant ones we can rely on? Well, one of these specialized algorithms goes by Counting Sort and is covered and implemented in this video.
Timestamps:
00:00 Introduction
00:35 What is Counting Sort?
02:11 Sorting an array using Counting Sort!
03:59 Counting Sort Implementation
06:45 Putting our Code to the Test
07:29 Counting Sort Implementation v2.0
11:34 Performance and Complexity
12:22 Thanks for Watching!
If you found this video helpful, check other Geekific uploads:
- Merge Sort (MergeSort) - Explained and Implemented: • Merge Sort Algorithm E...
- Quick Sort (QuickSort) - Explained and Implemented: • Quick Sort Algorithm E...
- LinkedList Implementation in Java: • Implementing the Linke...
- New Features in Java 17: • New Features in Java 1...
- Sorting Algorithms Complexity: • Sorting Algorithms Tim...
- Generics and Wildcards in Java Made Simple: • Generics and Wildcards...
- Heap Space vs. Stack Memory in Java: • Heap Space vs. Stack M...
- Graphs, The Fundamentals: • Introduction to Graphs...
- Introduction to Unit-Testing with TDD: • Introduction to Unit-T...
- Dual-Pivot Quicksort Explained and Implemented in Java: • Dual-Pivot Quicksort E...
- TimSort Explained and Implemented in Java: • TimSort Explained and ...
#Geekific #SortingAlgorithms #CountingSort #Java

Пікірлер: 11
@josephthecreator
@josephthecreator 2 жыл бұрын
BEST video I've stumbled across so far on explaining the counting sort algorithm. Really helps to see actual code with the video. Thank you!
@geekific
@geekific 2 жыл бұрын
Thanks a lot!! Glad it helped :)
@g1patil
@g1patil 2 жыл бұрын
thanks a ton for covering more use cases than simpler one. Really good. !! Hope more people come here and this channel grows !!
@geekific
@geekific 2 жыл бұрын
Thanks for your kind words they're much appreciated!
@dongct2504
@dongct2504 Жыл бұрын
you are simply the best
@bakermrad
@bakermrad 7 ай бұрын
this was amazing
@mohammad-karbalaee
@mohammad-karbalaee Жыл бұрын
Brilliant
@aryanmalewar7789
@aryanmalewar7789 2 жыл бұрын
can u explain how this sort works for strings??
@geekific
@geekific 2 жыл бұрын
Well, counting sort is typically used on integers as we are collecting the frequency of each integer in the array. But, if you would like to do a modified version that instead counts the occurrence of strings, you'd have to first map each string to an index (hashing) and then apply it as shown in the video. However, note that this would not be optimal at all if your array does not contain a lot of frequently repeated strings. Let me know if this answers your question!
@aryanmalewar7789
@aryanmalewar7789 2 жыл бұрын
@@geekific yeah, thanks :)
@botondmate607
@botondmate607 Жыл бұрын
Amazing video but do keep that in mind that these two algorithms are not stable.
Heartwarming: Stranger Saves Puppy from Hot Car #shorts
00:22
Fabiosa Best Lifehacks
Рет қаралды 12 МЛН
Vivaan  Tanya once again pranked Papa 🤣😇🤣
00:10
seema lamba
Рет қаралды 29 МЛН
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 152 МЛН
Counting Sort: An Exploration of Sorting Special Input In Linear Time
17:28
The Traveling Salesman Problem: When Good Enough Beats Perfect
30:27
Quicksort Sort Algorithm in Java - Full Tutorial With Source
24:58
Coding with John
Рет қаралды 232 М.
Merge Sort Algorithm in Java - Full Tutorial with Source
23:02
Coding with John
Рет қаралды 170 М.
Heartwarming: Stranger Saves Puppy from Hot Car #shorts
00:22
Fabiosa Best Lifehacks
Рет қаралды 12 МЛН