# Thread: the fastest algorthm to order?

1. ## the fastest algorthm to order?

what is the fastest algorithm to order an large amount of numbers?
Could someone write a simple example please? i've already tried bubble sort but it's extremly slow!!!

2. lol

too many edits on this

yeah, have you looked into qsort? I was not sure if that was a good function for sorting numbers or not.

3. sorry my mistake. is qsort ansi-c? it has to be Ansi-C!

4. >i've already tried bubble sort but it's extremly slow!!!
Bubble sort is second only to Bogo sort in suckiness.

>Could someone write a simple example please?
Check the contest forum. A recent thread has an implementation of quicksort.

>is qsort ansi-c?
Yes.

5. well you will find it in stdlib.h, if that helps - yeah it is standard C

6. >>Bubble sort is second only to Bogo sort in suckiness.
And what is this 'Bogo sort' you speak of?

7. >And what is this 'Bogo sort' you speak of?
Take a deck of cards. Throw them in the air and let them fall to the floor. Check to see if they're sorted. Repeat until they are. That's the equivalent of Bogo sort.

8. Gah!

Nothing like O(&#8734) efficiency!

9. I thought bogosort was O(N!)

10. Radix sort is pretty fast, look it up.

11. Bucket sort is pretty much the fastest sort, with a complexity of O(N). It uses huge amount of memory though, and is in most cases not practical especially when having duplicates.

12. Originally posted by Salem
I thought bogosort was O(N!)
I'm just going by Prelude's description, so in the worst case it would be O(&#8734).

13. Yeah, actually it doesn't have an O value as such.

It is a probablility, that being 1 : N! of actually coming up with the right answer in any given trial.

14. I wonder how many monkeys it would take to implement the bogo sort?

15. depends how fast you want it one monkey could implement it just fine, except the monkey might die before completing the process.