Better than O ( n ! ) O(n!) ?

Given below is sorting algorithm( sort(l) ).

1
2
3
4
5
6
7
8
import random
import time

def sort(l):
    while is_not_sorted(l):
        time.sleep(60*60)  # Wait one hour
        random.shuffle(l)  # Shuffle the list
    return l

Given an array l , your task is to find the expected number of hours Q Q , it takes for the sorting algorithm to finish sorting l ?

For each of the arrays in this file , find Q Q for each array and input the sum of the Q Q s as your answer.


The answer is 233829804084466.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...