Data structure cheat sheet: Difference between revisions

Jump to navigation Jump to search
Line 131: Line 131:
* reverse the tail:
* reverse the tail:
<pre>672[1345]</pre>
<pre>672[1345]</pre>
==== Generate the k-th permutation of N ====
The idea is to generate the permutation one element by one element:
we can determine the first element of the permutation by comparing k with N,
then repeat this procedure.
==== Generate permutations with the duplications ====
This can be done with a simple backtracking search.


==== Heap's algorithm ====
==== Heap's algorithm ====