CS21003 Algorithms I CS29003 Algorithms Laboratory |
Autumn 2012, L-T-P: 3-1-0 L-T-P: 0-0-3 |
Programming Assignment 1
You are given two postive integers n and k. Your task is to fill an array of size n such thatWrite a recursive function to do the following:
- All elements of A are integers in the range 1,2,...,k.
- A is sorted in the increasing order.
- Each of the integers 1,2,...,k appears at least once in the array.
- Report all possible ways of generating the array A.
- Return the count of possibilities.
Sample output
n = 4 k = 3 The possibilities are: 1 1 2 3 1 2 2 3 1 2 3 3 Total number of possibilities = 3