|
Post by juju on Oct 4, 2015 17:46:24 GMT
Does this mean anything to you?
|
|
|
Post by JoeP on Oct 4, 2015 18:39:06 GMT
It means someone has too much time on their hands.
|
|
|
Post by guest moose on Oct 4, 2015 18:57:10 GMT
pi?
|
|
|
Post by JoeP on Oct 4, 2015 19:08:57 GMT
It's a Bubble sort. The part of the dance where they're in a line with a[0] etc over their heads is the sort. The dancers dance in pairs, exchanging places if their numbers are in the wrong order.
|
|
|
Post by jayme on Oct 4, 2015 19:17:34 GMT
|
|
|
Post by Moose on Oct 4, 2015 19:37:28 GMT
hm I just realised that of COURSE I'd recognise the numbers for pi because .. it's all the numbers 0-9
|
|
|
Post by jayme on Oct 4, 2015 20:15:47 GMT
It's a Bubble sort. The part of the dance where they're in a line with a[0] etc over their heads is the sort. The dancers dance in pairs, exchanging places if their numbers are in the wrong order.
|
|
|
Post by Alvamiga on Oct 4, 2015 20:49:02 GMT
Now we need someone to invent the binary linked tree dance!
|
|
Yuki
Senior members
Posts: 632
|
Post by Yuki on Oct 7, 2015 17:56:48 GMT
Now I understand why the Bubble Sort is the slowest sorting algorithm out there!
|
|
|
Post by tangent on Oct 7, 2015 21:42:07 GMT
*dwells on warm memories of past programming courses*
|
|
|
Post by tangent on Oct 7, 2015 21:51:37 GMT
Now I understand why the Bubble Sort is the slowest sorting algorithm out there! I think Djikstra's recursive algorithm is slower when the numbers are already in order. It's something like this: if length of row of numbers > 2 then split row into two and sort both left and right rows else if first number > second then swap two numbers exit That's not exactly it but my brain isn't working properly tonight because I've had a couple of drinks.
|
|
|
Post by Alvamiga on Oct 9, 2015 8:22:19 GMT
Just use a self balancing binary linked list and never have your data out of order in the first place!
|
|
|
Post by ceptimus on Oct 27, 2015 0:17:51 GMT
There's the shuffle sort where you just randomly shuffle, check if the items are in order and keep repeating till they are. There have been even slower sorts devised that can be proved to not complete before the heat death of the universe for any significant size of items.
Fastest ones are radix sorts, merge sorts or variations of quicksort - it depends on the nature of the items being sorted, and whether or not they are already partly ordered which method is best.
|
|
|
Post by Alvamiga on Oct 27, 2015 22:18:25 GMT
As usual, it all depends on what you're doing with the data, the number of items, how often it's updated and so on. There are even cases where keeping the data sorted is more inefficient than just searching through it when you need something out of it.
|
|