Permutations of size (k). Modify Permutations from the previous exercise so that it takes two command-line arguments
Question:
Permutations of size \(k\). Modify Permutations from the previous exercise so that it takes two command-line arguments \(n\) and \(k\), and prints all \(P(n, k)=\) \(n ! /(n-k)\) ! permutations that contain exactly \(k\) of the \(n\) elements. Below is the desired output when \(k=2\) and \(n=4\) (again, do not worry about the order):
ab ac ad ba be bd ca cb cd da db dc
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted: