…ranking and unranking. Sedgewick 77 [1] calls it the Fischer-Krause algorithm. The traditional (and still readable) reference for generating combinatorial objects such as permutations is Nijenhuis & Wilf's Combinatorial Algorithms. The author of the article ubiquitously misspells "lexicographic" as "lexographic." That might make it harder to Google the term. [1] https://www.princeton.edu/~rblee/ELE572Papers/p137-sedgewick...
这显然是一个 n^2 排序。Nijenhuis 和 Wilf 1975 年的《Combinatorial Algorithms》里包含了一个 23 行 Fortran 实现的 Heapsort(一种 n log n 排序)。它在网上公开且很容易找到,所以我就把它列在这里。我并不打算去尝试…
Of course this is a n^2 sort. Combinatorial Algorithms by Nijenhuis and Wilf, 1975, has a 23 lines Fortran implementation of Heapsort, a n log n sort. It is available on the web and easily found, so I am going to list it here. I am not going to attempt to…
…ranking 和 unranking。Sedgewick 77 [1] 将其称为 Fischer-Krause 算法。生成像排列这种组合对象的传统(且现在读来依然通俗易懂的)参考文献是 Nijenhuis & Wilf 的《Combinatorial Algorithms》。文章作者到处都把 "lexicographic" 拼错成了 "lexographic"。这可能会让人更难在 Google 上搜到这个术语。[1] https://www.princeton.edu/~rblee/ELE572Papers/p137-sedgewick...
…ranking and unranking. Sedgewick 77 [1] calls it the Fischer-Krause algorithm. The traditional (and still readable) reference for generating combinatorial objects such as permutations is Nijenhuis & Wilf's Combinatorial Algorithms. The author of the article ubiquitously misspells "lexicographic" as "lexographic." That might make it harder to Google the term. [1] https://www.princeton.edu/~rblee/ELE572Papers/p137-sedgewick...
这显然是一个 n^2 排序。Nijenhuis 和 Wilf 1975 年的《Combinatorial Algorithms》里包含了一个 23 行 Fortran 实现的 Heapsort(一种 n log n 排序)。它在网上公开且很容易找到,所以我就把它列在这里。我并不打算去尝试…
Of course this is a n^2 sort. Combinatorial Algorithms by Nijenhuis and Wilf, 1975, has a 23 lines Fortran implementation of Heapsort, a n log n sort. It is available on the web and easily found, so I am going to list it here. I am not going to attempt to…