Heap's algorithm: Difference between revisions

Content deleted Content added
// minor edit
Line 89:
</syntaxhighlight>
 
Claim: If array {{mvar|A}} has length {{mvar|n}}, then performing Heap's algorithm will either result in {{mvar|A}} being "rotated" to the right by 1 (i.e. each element is shifted to the right with the last element occupying the first position) or result in {{mvar|A}} being unaltered, depending on if {{mvar|n}} is even or odd, respectively.
 
Basis: The claim above trivially holds true for <math>n=1</math> as Heap's algorithm will simply return {{mvar|A}} unaltered in order.