Write a program Combinations that takes an integer command-line argument (n) and prints all (2^{n}) combinations of
Question:
Write a program Combinations that takes an integer command-line argument \(n\) and prints all \(2^{n}\) combinations of any size. A combination is a subset of the \(n\) elements, independent of order. As an example, when \(n=3\), you should get the following output:
a ab abc ac b bc c Note that your program needs to print the empty string (subset of size 0 ).
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: