how can i access each permutation of an array individually found by heap algo?
i.e.,permutations of heap algo for {1,2,3}
generate
1 2 3
2 1 3
3 1 2
1 3 2
2 3 1
3 2 1
so i want to access each array permuatation and perform some operation on it
A "heap" is just an array that is accessed in rows of increasing length. (For a binary heap, each row has twice as many elements as the previous.)
Whenever you perform a push down, just print the elements of the array. You can print every time there is a swap, or every time a complete push down is done.
For terminology, each time you modify the heap, you are "permuting" it.