| CS21003 Algorithms I
CS29003 Algorithms Laboratory
|Autumn 2012, L-T-P: 3-1-0
Programming Assignment 1You are given two postive integers n and k. Your task is to fill an array of size n such that
Write 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 outputn = 4 k = 3 The possibilities are: 1 1 2 3 1 2 2 3 1 2 3 3 Total number of possibilities = 3