Sample Programming Assignment
Chapter 9
Recursive Thinking
Preliminary Version


Note:

This is a preliminary version of a file of sample programming assignment for Data Structures and Other Objects.
Chapter 9 Assignment
The function arrange is a recursive function which has two inputs, first and
second which are both strings (from our string ADT of Chapter 4).  The
function prints all rearrangements of the letters in first, followed by
second. For example, if first is the string "CAT" and second is the string
"MAN", then the function would print the strings CATMAN, CTAMAN, ACTMAN,
ATCMAN, TACMAN, and TCAMAN. The stopping case of the function occurs when the
length of first has zero characters.

Implement the function arrange with the specification below.

void arrange(String first, String second); 
// Postcondition: All rearrangements of the letters in first, followed by
second are printed to cout.

It will be easier to implement this function if the string class has the
additional methods:

void insert(size_t position, char c);
   Postcondition: A copy of character c has been inserted into the string 
   at the indicated position. Existing characters that used to be at or 
   after the given position have been shifted right one spot.

void remove(size_t position, size_t n);
   Precondition: position + n <= length( ).
   Postcondition: n characters have been removed from the string, beginning at
   the specified position.