A medley of recursive methods
Write the method
public Set<String> generateAllPhoneWords(String phonenumber)
1 | 1 | 1 | 1 | 1 |
1 | 0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 1 |
0 | 1 | 0 | 0 | 1 |
1 | 1 | 1 | 0 | 1 |
2 | 1 | 1 | 1 | 1 |
2 | 0 | 0 | 0 | 0 |
2 | 2 | 2 | 2 | 2 |
0 | 1 | 0 | 0 | 2 |
1 | 1 | 1 | 0 | 2 |
* | * | * | |||||||
* | * | ||||||||
* | * | ||||||||
* | * | * | * | ||||||
* | * | * | * | * | |||||
* | * | * | * | * | * | * | * | ||
* | * | ||||||||
* | |||||||||
* | * | * | * | ||||||
* | * |
There are 5 organisms as shown below:
1 | 1 | 5 | |||||||
1 | 5 | ||||||||
5 | 5 | ||||||||
2 | 5 | 5 | 5 | ||||||
2 | 2 | 5 | 5 | 5 | |||||
2 | 2 | 5 | 5 | 5 | 5 | 5 | 5 | ||
3 | 5 | ||||||||
5 | |||||||||
4 | 4 | 4 | 5 | ||||||
4 | 5 |
Write a recursive method
public int numOrganisms(boolean[][] world)
1, 2, 3, 4
1, 2, 4, 3
2, 3, 4, 1
2, 2, 4, 3
5, 1, 2, 3
public Set<int[]> generateAllArrangements(Set<Integer> set)
Once you finish implementation, you must turn in the above four files.
Your assignment will be graded first by automated testing. After that, we
will read your code to determine whether requirements were satisfied, as well as judge the
overall style of your code. Programs will be graded both on correctness as well as the
style. Points will be deducted for poor design decisions and un-commented, or un-
readable code.
For this lab specifically, you will also be graded on your recursive thinking. Make sure you are solving the problems recursively.
Here is the point breakdown: