Can we sort elements without comparing them? (Counting sort) - Inside code

  Рет қаралды 6,944

Inside code

Inside code

Күн бұрын

Source code: gist.github.com/syphh/2ce8ef5...
🔴 Learn graph theory algorithms: inscod.com/graphalgo
⚙ Learn dynamic programming: inscod.com/dp_course
💡 Learn to solve popular coding interview problems: inscod.com/50problems_course
⌛ Learn time and space complexity analysis: inscod.com/complexity_course
🔁 Learn recursion: inscod.com/recursion_course
NB: This video is ad-free, you can choose to support Inside code by purchasing one of the courses above or dropping a super thanks!
NB2: Discounts of courses above are permanent
I also post content on LinkedIn (inscod.com/linkedin) and Instagram (inscod.com/instagram)

Пікірлер: 16
@TheDarkOne629
@TheDarkOne629 2 жыл бұрын
In uni, we got the assignment to find the best sorting algorithm to sort a million elements. At first I thought it was counting sort and it did well up to half a million elements but after that it became way too slow. Same for radix sort, which worked well for most students. The one that did it for me was pigeonhole sort. (The highest number of values I tested was 100 million) Interesting little story I hope. :P
@insidecode
@insidecode 2 жыл бұрын
It depends on properties of those elements, and thanks for the story
@Ninvus2
@Ninvus2 Жыл бұрын
Doesn't the max() and min() function involve comparing all values in the array?
@jsjnumbers6389
@jsjnumbers6389 3 жыл бұрын
I have only taken an introduction to computer logic, and have not learned any language yet in particular, so I know I can translate every one of these commands to any language using the corresponding syntax, so my question is, whether this is your version of pseudo code or is this actual syntax for a particular language and if so, what language.
@insidecode
@insidecode 3 жыл бұрын
Yes I used a real programming language: Python
@hyper0505
@hyper0505 2 жыл бұрын
what if we want to get the median of some data with counting sort by using the count array,not the arr? can we possibly do that? i was figuring it out....
@ctcrnitv
@ctcrnitv 2 жыл бұрын
00:10 this seems to me like a misleading visualization of insertion sort because it shows a swap being done on each iteration. As far as I know, the implementation involves storing the first unsorted element in a temp, copying the greater values in the unsorted half to the right, and only as a final step is putting the temp value back into the array.
@insidecode
@insidecode 2 жыл бұрын
Yes that's another possible implementation, both work
@RandomGeometryDashStuff
@RandomGeometryDashStuff 2 жыл бұрын
How does it get min and max without comparing?
@insidecode
@insidecode 2 жыл бұрын
What we're doing here is that we're kinda putting our elements on a long x-axis, for example if we have 12 we put it in x=12. After doing so, the leftmost element in the axis is the minimum and the rightmost element is the maximum
@RandomGeometryDashStuff
@RandomGeometryDashStuff 2 жыл бұрын
@@insidecode 04:17 getting minimum does use comparison
@insidecode
@insidecode 2 жыл бұрын
No you just start from the left and the first element that you find is the minimum
@parthmakode5255
@parthmakode5255 3 жыл бұрын
i appreciate the effort but i stil didnt get it can you use a different voiceover for it please
@insidecode
@insidecode 3 жыл бұрын
Can you tell me what part you didn't get, I'll try to explain it here
@paulotcj
@paulotcj 7 ай бұрын
If you could speak without a sock in your mouth that would be great. Also, it's noticeable you are not comfortable explaining this. Learn the algo properly, then once you are confident, explain it. You did try to go way too fast in the part you don't know much about it.
@insidecode
@insidecode 7 ай бұрын
Thanks for feedback! Can you briefly check recent videos and tell me if sound quality/explanation improved?
How to shuffle an array (Fisher-Yates algorithm) - Inside code
6:03
Heaps, heapsort, and priority queues - Inside code
19:01
Inside code
Рет қаралды 72 М.
MEGA BOXES ARE BACK!!!
08:53
Brawl Stars
Рет қаралды 34 МЛН
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
Counting Sort
3:48
theteachr
Рет қаралды 27 М.
This is how Paint's bucket fill works (Flood fill algorithm)
8:54
Count Sort Algorithm - Theory + Code
20:44
Kunal Kushwaha
Рет қаралды 15 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
N-queens problem (Backtracking) - Inside code
14:13
Inside code
Рет қаралды 7 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 765 М.
Insertion Sort Algorithm - Theory + Code
30:40
Kunal Kushwaha
Рет қаралды 204 М.
Сортировка подсчетом (counting sort)
5:37
Evgeniy M
Рет қаралды 26 М.
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 27 МЛН
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,3 МЛН
Gizli Apple Watch Özelliği😱
0:14
Safak Novruz
Рет қаралды 4,3 МЛН