Discrete Mathematics and Its Applications, Seventh Edition

Published by McGraw-Hill Education
ISBN 10: 0073383090
ISBN 13: 978-0-07338-309-5

Chapter 6 - Section 6.6 - Generating Permutations and Combinations - Exercises - Page 439: 17

Answer

algorithm for producing all permutations of a set of n elements based on the correspondence

Work Step by Step

procedure Cantor permutation(n, i: integers with n ≥ 1 and 0 ≤ i < n !) x := n for j := 1 to n pj := 0 for k := 1 to n − 1 c := x/(n − k)!; x := x − c(n − k)!; h := n while ph \ne 0 h := h − 1 for j := 1 to c h := h − 1 while ph = 0 h := h − 1 ph := n − k + 1 h := 1 while ph \ne= 0 h := h + 1 ph := 1 {p1p2 . . . pn is the permutation corresponding to i}
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.