Project: Allow the user to input letters, and output the words that can be made by rearranging the letters.


Break down the input into smaller inputs until you are left with one letter. Once again, you can use recursion. Recursive functions always have a base case and a recursive case. The base case returns a result, and the recursive case reduces the problem toward the base case. It is very important that you have a base case, otherwise, the function will never terminate.
In this case, the function will take a string as a parameter, extract one letter, and then call itself with the remaining letters. Eventually, the function will stop calling itself when it cannot extract any more letters.
Last section Next section