SIAM Journal on Computing
An introduction to the analysis of algorithms
An introduction to the analysis of algorithms
Selected papers on analysis of algorithms
Selected papers on analysis of algorithms
Phase Change of Limit Laws in the Quicksort Recurrence under Varying Toll Functions
SIAM Journal on Computing
A heuristic to accelerate in-situ permutation algorithms
Information Processing Letters
Cost distribution of the Chang-Roberts leader election algorithm and related problems
Theoretical Computer Science
Hi-index | 0.00 |
Permuting in place has been first analyzed by Knuth. It uses the cycle structure of the permutation. The elements of an array to be permuted are only moved when one sees a cycle leader (smallest element in its cycle). So the essential part of such an algorithm is to test an element i about whether it is a cycle leader.Recently, Keller [Inform. Process. Lett. 81 (2002) 119-125] introduced two stopping rules: "If the last cycle leader has been detected, all elements have been moved, and no further tests are necessary" (heuristic 1), respectively "If only r elements have not been moved, then proceeding along a cycle is only useful for r steps" (heuristic 2).We analyze the average costs of these modifications applied to the standard algorithm of Knuth; they are (n + 2)Hn - 5n/2 - 1/2 ∼ n log n and respectively ((2n + 1)/4)H|(n-1)/2| + (1/2)H2⌊(n+1)/2⌋ - (1/2)(⌊(n + 1)/2⌋ - ⌊n/2⌋) - (n+1)/2 ∼ (n/2) log n, as opposed to (n + 1)Hn - 2n ∼ n logn in the classical case.