PROJECT EULER · #0367
Bozo Sort
Bozo sort, not to be confused with the slightly less efficient bogo sort, consists out of checking if the input sequence is sorted and if not swapping randomly two elements. This is repeated until eventually the sequence is sorted.
If we consider all permutations of the first
The already sorted sequence takes
In this problem we consider the following variant on bozo sort.
If the sequence is not in order we pick three elements at random and shuffle these three elements randomly.
All
The already sorted sequence will take
If we consider all permutations of the first
Consider as input sequences the permutations of the first
Averaged over all
Give your answer rounded to the nearest integer.
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.