Introduction


In this set of lessons, you will use programming skills you have already learned, ones you are about to learn and your own problem solving skills to create a more complex program than you have probably attempted before. The lessons will guide you through all of the material you will need to know in order to achieve this, and in coding the software yourself you will get to put everything you have learned to date into practice. Not only will this help you to learn, understand and remember it better, but also you will gain some practice of solving computing problems yourself.

You will be developing a program that generates anagrams of a user-entered word. If this is a long word, there will be many different outputs (for example, a 6 character word would produce 6! = 720 outputs). In order to cope with such potentially large numbers of output anagrams, you will also be devising an algorithm to arrange the words in a table (for example, 24 words may be printed as 6 lines of 4 words).

An example of output anagrams would be, using the input "cat":

cta

tac

tca

act

atc


The anagrams do not have to be words themselves, simply a rearrangement of the characters in the input.

Please note that while this program will work for very large input words, it will become noticeably slower if you start to use words that are more than 6 or 7 characters long. This is because the number of outputs is the factorial of the number of characters in the input. See below to see how quickly factorial numbers grow:



Mountain View




Go to Lesson 1 Part A

Back to Index