Posting Freak
Posts: 6,406
Threads: 399
Joined: 2008-07
Gender: Male
Assuming the animations reflect time consumption... is there any reason to use one other than Quick Sort?
But other than my mass confusion, this is pretty cool.
Posting Freak
Posts: 5,248
Threads: 347
Joined: 2008-07
Gender: Male
Sexual Orientation: Lesbian
I've always liked Bubble Sort. It has a cute name and it's the easiest to learn. I had to do a presentation in class for Merge Sort about two years ago.
Quick Sort was a pain in the ass to learn in the beginning. I don't remember how Selection does it's thing.
Test Mushroom
Posts: 10,045
Threads: 1,506
Joined: 2008-06
Gender: Male
Sexual Orientation: Straight
Country Flag: usa
IGN: GuavaCowboy
Server: Zenith
Level: 10x
Job: Jett
Guild: L>
[video=youtube;t8g-iYGHpEA]http://www.youtube.com/watch?v=t8g-iYGHpEA[/video]
[video=youtube;iXAjiDQbPSw]http://www.youtube.com/watch?v=iXAjiDQbPSw[/video]
c
Posting Freak
Posts: 8,478
Threads: 128
Joined: 2008-07
Gender: Neuter
Country Flag: canada
IGN: Oooh
Server: Bera
Job: Empress
Farm: Stereo
What I don't understand about insertion sort, as presented in the original link, is...
Why go back in descending order? Would it not be faster to cut the sorted in half every time by comparing it to the middle element, using log(sorted) instead of linear(sorted) time?
I guess it's a data structure thing? If your sorted data's in a simple array, you need to move all the elements anyway. But if it's in something different where insertion's O(1) then using a log time to find the point seems better.
Posting Freak
Posts: 4,302
Threads: 256
Joined: 2008-07
Gender: Male
Level: 251
I don't know of any sequential data structure for which both insertion and random access (which is needed for the binary search you're describing) are O(1).
So assuming both ways of insertion sort are O(n^2)y its only real use is as a way to sort small data sets that is very simple to implement from scratch, so saving some time on the comparisons might not be worth complicating things when you could just use a better algorithm instead.