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

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

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 6 ай бұрын
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.
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 11 МЛН
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 4,5 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Counting Sort: An Exploration of Sorting Special Input In Linear Time
17:28
Learn Counting Sort Algorithm in LESS THAN 6 MINUTES!
5:59
CS Dojo
Рет қаралды 331 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
A Simpler Way to See Results
19:17
Logan Smith
Рет қаралды 97 М.
Count Sort Algorithm - Theory + Code
20:44
Kunal Kushwaha
Рет қаралды 15 М.
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 11 МЛН