- To write program to enter unique characters of string
- To be able to do permutations
- To practice solving problems using BTrees
- To practice writing solutions to problems in a clear and succinct way
Problem
You are required to construct a program that will perform the following sequence of operations:
- Reads a string and an integer, N, where the value of N is no larger than the number of characters in the string. (You may assume that the characters in the string are not repeated)
- Generate and output all possible N-character permutations of the characters in the string.
- Store the generated permutations, as they are calculated, in a 2-4 tree. Print the inorder traversal of the tree.
E.g.
Input AbdDC 2
Output
Ab, Ad, AD, AC, bA, bd, bD, bC, dA, db, dD, dC, DA, Db, Dd, DC, CA, Cb, Cd, CD
Reviews
There are no reviews yet.