Question: Please help solve! I will upvote!! Bogosort (also called Stupidsort) is an algorithm for sorting, and is perhaps the worst algorithm you have heard of.

Please help solve! I will upvote!!

Bogosort (also called Stupidsort) is an algorithm for sorting, and is perhaps the worst algorithm you have heard of. In order to sort n numbers given as an array A, Bogosort uniformly at random generates a permutation of the n numbers in A, and then checks if they are actually sorted in increasing order.

Let X be a random variable that denotes the number of iterations of Bo- gosort until it finds the sorted version of A in increasing order. What is the expected value of X? If we were happy with either increasing or decreasing order, what would be the expected number of iterations then? (Hint: if you have a fair coin, how many times in expectation should you toss it, till you see the first Tails?)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!