Algorithms #3 - Selection Sort
Uploader Comments (codegearguru)
Top Comments
-
Your an awesome teacher!
All Comments (35)
-
yeah basically in code form this would be the equivalent of creating another array to store the sorted items
-
the video does note move the first element in each iteration to the correct position (min element). For me this looks like that you create a second array where you incrementally insert the min element.
-
yes this helped me understand it, now how do i put it in my program =/
-
It helped with class!
-
where is the swap/exchange ?? :O
-
If you use first element as the pivot and find the minimum or maximum value? Would be great if you could show this with the cards? Thanks
-
@BkBlu45 This would defeat the purpose of the video. However, your question is fair enough. There are different ways of "putting the cards in order, biggest to smallest." Why is this important? Because some ways are faster than others. Lets say that instead of doing this method I check each two adjacent cards and if the first is bigger than the second I swap them and check the next two cards, etc.. I will have to do this many many times before all my cards are sorted. Method is important.
-
@1nglewattz1 it's "ur" not "your" duhhhhhhhh
-
I think this whole series is so creative and plainly excellent. Now I understand all the tricks in 3 minutes, compared reading confusing texts for hour!
Good job.
This comment has received too many negative votes show
I don't get what all the fuss is about.... why don't you just say, put all the cards in order, biggest to smallest (Ace being smallest and 9 being the biggest)
someone enlighten me
BkBlu45 2 years ago
@BkBlu45 Yes, and it would be wonderful if a computer could understand those instructions, but they don't and you have to program the computer in excruciating detail exactly how to sort the cards (or at least someone does and you use their library)
codegearguru 2 years ago 24
Great sorting videos with playing cards, I like them all. But this video should be called "Selection sort".
I think Selection sort have at least one advantage over Insertion sort, and it's doing the minimum "swap" to sort the entire list or array. Because swaping cost more than comparing, Selection sort is better.
There still other popular sorting algorithms like shell sort, heap sort, and quick sort. Will you explain them too with playing cards?
newcoleco 3 years ago
Oops, thanks newcoleco your right, I have updated the title and description - not sure how i missed this one.
codegearguru 3 years ago