Question: Bogosort is a sorting algorithm that orders a list in increasing order by taking the list, checking to see if the list is ordered increasingly,



Bogosort is a sorting algorithm that orders a list in increasing order by taking the list, checking to see if the list is ordered increasingly, if the list is not ordered increasingly then the list is randomly shuffled, and then repeating this process until the list is ordered increasingly Expressed in pseudocode: Algorithm 1 Bogosort Require: list: 21, 22, ..., An of real numbers Ensure: list is sorted in increasing order 1: procedure BOGO(list) while not sorted(list) do Checks to see if list is sorted shuffle(list) Shuffle the current list if not sorted end while 5: end procedure 2: 4: We will now find the average-case time complexity for bogosort where we are ordering the list 21, 22, ..., On. We begin by finding the average number of shuffles needed to order the list. a 3. Consider the Bernoulli trial where a success is that a random permutation of 21,22,..., en is ordered and a failure that a random permutation of a1, 02, ..., An is not ordered. What is the probability of success? What is the probability of failure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
