Debian Codegraph @

docs/manual/Permutation__Next.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>Permutation: Next</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
12 Permutation: Next
13 </b></font></table></table>
14 <p>Get the next <a href="Permutation.html">permutation</a> in <a href="lexicographic_permutation_order.html">lexicographic permutation order</a>. </p>
15 <p>The next permutation is obtained from the selected permutation by swapping values <i>at only two positions</i>. Starting with the identity permutation and repeatedly applying this function will iterate through all possible permutations. If no further permutation is available, i.e. the selected permutation is at the lexicographic end position (n, n-1, ..., 3, 2, 1), the current permutation will not change anymore. </p>
16 <h2>Examples</h2>
17 <p>If we start with (1,2,3,4) successively applying <b>Next</b> will generate the following sequence (1,2,4,3), (1,3,2,4), (1,3,4,2), (1,4,2,3), (1,4,3,2), etc.</p>
18 <h3>Links to this page</h3>
19 <ul>
20 <li><a href="Permutation__Previous.html">Permutation: Previous</a>
21 </ul>
22 <hr>
23 <address>
24 <p>© djmw 20140131</p>
25 </address>
26 </body>
27 </html>