Compute and return number of strings of a as b bs and c cs


Assignment: Combinations and permutations Discrete Structures

Build the following programs:

1. unsigned combABC(unsigned n);

combABC outputs each combination of n letters, where each letter is A, B, or C, exactly once. For

example, combABC(4) would output 15 lines:

combABC should also return the number of combinations; it should be the number of combinations by computation, not just counting how many lines of output it produces.

AAAA
AAAB // or it could just as well output ABAA, since that's the same combination
AAAC
AABB
AABC
AACC
ABBB
ABBC
ABCC
ACCC
BBBB
BBBC
BBCC
BCCC
CCCC

2. unsigned f(unsigned a, unsigned b, unsigned c);

Compute and return the number of strings of a A's, b B's, and c C's. For example, f(1, 2, 1) returns 12 because there are 12 strings made up of 1 A, 2 B's, and 1 C:

ABBC
ABCB
ACBB
BABC
BACB
BBAC
BBCA
BCAB
BCBA
CABB
CBAB
CBBA.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Compute and return number of strings of a as b bs and c cs
Reference No:- TGS02670636

Expected delivery within 24 Hours