C program for Bogo sort algorithm

C program for Bogo sort algorithm : Bogosort Algorithm is also known as stupid sort or slow sort. Bogo sort is a particularly ineffective sorting algorithm based on the generate and test paradigm. It is not useful for sorting, but it is useful for educational purposes, to contrast it with other more realistic algorithms. It has also been used as an example in logic programming. If Bogosort is used to sort a deck of cards, it would consist of checking if the deck were in order, and if it were not, throwing the deck into the air, picking the cards up at random, and repeating the process until the deck is sorted. Let us see how to implement C program for Bogo sort algorithm.

Well, I am software programmer and love to code. My hobbies is to do Hacking, Coding, Blogging, Web Designing and playing online games.
Feel free to contact me at shiviskingg@gmail.com or lokesh@hackingloops.com

@ Eric
Shuffle Logic :
shuffle(int *a, int n)
{
int i, t, r;
for(i=0; i < n; i++) {
t = a[i];
r = rand() % n;
a[i] = a[r];
a[r] = t;
}
}
The above shuffle logic is as per requirement of Bogo sort. As bogo sort shuffling is equivalent to shuffling a deck of cards. So it didn't seems to be biased.
Also I mentioned Bogo Sort as not useful because of its time complexity, also its a hit and trail method, so we cannot guarantee the actual time. As the number of elements to be sorted increase, its time of execution increases significantly.
I hope this answers your query.. If you still have doubts, ask us in form of comments.

Nice post. I was checking constantly this weblog and I am inspired! Extremely helpful information particularly the ultimate section :) I maintain such information a lot. I was seeking this certain information for a long time. Thank you and good luck.salvatore ferragamo shoessale