Chance one bubble sort pass fully sorts 100 items
Question
A uniformly random permutation of goes through a single left-to-right pass of bubble sort. The probability that the list is then fully sorted can be written as with integers . Find .
Short answer
. Running the pass backwards from the sorted list, each of the adjacent comparisons is either a swap or not, and each pattern yields a different starting permutation. So of the permutations work, and .
Adapted from QuantQuestions.io; question and answer rewritten by SelfMadeQuant.com.
See the hint and the full worked solution in the question bank (free account).
Open the worked solutionLessons behind this question
- Counting and Combinatorics
- Algorithms, Growth Rates, and Asymptotic Notation
- Quicksort and Randomized Quicksort
Start with a free lesson: Probability Fundamentals is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.
Read it free