Permute By Sorting
- (CLRS Lemma 5.4) Assuming all priorities
are distinct, then the input is randomly permuted.
Fisher-Yates
-
(CLRS Lemma 5.5). This algorithm produces a uniform random permutation.
This holds because of the following following loop invariant:
Just prior to the
-th iteration of the loop, for each possible -permutation of the elements, the subarray contains with probability