Factorial time




An example of an algorithm that runs in factorial time is bogosort, a notoriously inefficient sorting algorithm based on trial and error. Bogosort sorts a list of n items by repeatedly shuffling the list until it is found to be sorted. In the average case, each pass through the bogosort algorithm will examine one of the n! orderings of the n items. If the items are distinct, only one such ordering is sorted. Bogosort shares patrimony with the infinite monkey theorem.

Comments

Popular posts from this blog

43)Sheikh Hasina the right choice as main guest to the Republic Day but trust the PMO to miss the obvious

Linear time

Sub-linear time