Homework 1, Clarifications: 22C:21 Computer Science II: Data Structures
- On Problem 2: The modified stampCount function continues to return an int,
which stands for the size of the smallest change. However, by consulting the second argument the user can
obtain the actual optimal change. More specifically, the user should do the following:
int answer[amount+1][3];
int min = stampCount(amount, answer);
Then by looking at answer[amount][0], answer[amount][1], and
answer[amount][2], the user can get the optimal change for amount.
- On Problem 1: The function header
int findMax(int[] A, int n)
is a wrapper for the actual recursive function, which will need two int
arguments to keep track of the left and the right boundaries of the array.
- Problems 3 and 4: The semantics of the addElement
function are a little unclear. Implement this funtion so that it changes
the multi-set it is acting on and it returns a reference to this multi-set.