Do one (1) of the following assignments:
Recursion, what is that?
From Wiipedia: Recursion (see recursion), in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition.
Here is the problem, or actually 3 problems!
Create a program using recursion that does the following:
For example, if you call
ArrayList<String> result = recursiveObject.listMnemonics("623")
your method shall generate and return an ArrayList containing the following 27 possible letter combinations that correspond to that prefix:
MAD MBD MCD NAD NBD NCD OAD OBD OCD
MAE MBE MCE NAE NBE NCE OAE OBE OCE
MAF MBF MCF NAF NBF NCF OAF OBF OCF
Recursion, what is that?
From Wiipedia: Recursion (see recursion), in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition.
Here is the problem
Solving a maze with recursion is a "well known and solved problem". Implementing the solution is another thing! The following will be the assumptions we will be working with:
to see this in action goto http://www.cs.bu.edu/teaching/alg/maze/
Create a program that does the following:
.
' = open, #
' = blocked, S
' = start,G
' = goal, +
' = path, Two part assignment
This is a 2 week assignment:
Each week ENSURE you include the Marking Rubric
n
what is printed (boldface is for emphasis and will not be printed)
Things to note
1
1
2
1 2 1
3
1 2 1 3 1 2 1
4
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1
This produces a numeric pattern symmetric about n where each half before and after n is also symmetric around n-1. The newline after printing any integer larger than 5 provides a nice line length and also makes the pattern of the bigger numbers along the right edge reading down. If you get the normal pattern, that will just happen. Don't think about it. Output for an input of 7 is:
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1
* * * *
* * *
* *
*
*
* *
* * *
* * * *
Or, you could just do this!
Create a program Boggle program, like this.
Finding all the different possible words is a recursive algorithm. You can then use a web service to see if the string is really a word.
Two part assignment
This is a 2 week assignment:
Each week ENSURE you include the Marking Rubric
Things to note