Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 12.1
- 3.
- 1
- 1, 2
- 1, 3
- 1, 2, 4
- 1, 2, 4, 8, 16
- 1, 3, 7, 15, 30
- 1, 3, 6, 12, 25, 50, 100
- 4.
- 113
- 140, 70
- 168, 84, 42
- 120, 60, 30
- 160, 80, 40, 20, 10
- 5.
- *
- [*]
- ([*])
- ([([*])])
- [([([*])])]
- 12.2
- 8.
- call stack is the structure of information about all methods that have currently been called by your program. Recursion produces a tall call stack in which each recursive call is represented.
- 9. lines would stay in the original order
- 10.No base case so it would call its self forever
- 12.3
- 13.
- 6
- 4
- 7
- 0
- 1
- 14.
- 57
- 1029
- -74
- 2438
- 132483
- 15.
- 7
- 6
- 4
- 10
- 5
- 20.
- A image that recursively redraws smaller versions within itself
- 21.
- public static void drawHexagon(Graphics g, Point position, int size) {
- Polygon poly = new Polygon();
- poly.addPoint(position.x, position.y + size / 2);
- poly.addPoint(position.x + size / 3, position.y);
- poly.addPoint(position.x + 2 * size / 3, position.y);
- poly.addPoint(position.x + size, position.y + size / 2);
- poly.addPoint(position.x + 2 * size / 3, position.y + size);
- poly.addPoint(position.x + size / 3, position.y + size);
- g.drawPolygon(poly);
- }
- 22.
- Recursion is an effective way to implement a backtracking algorithm because the memory of decisions and points to go back to are represented by the recursive call stack. The pattern of "choose, explore, un-choose is elegantly represented by recursive calls for each individual choice.
- 23.
- A decision tree is a description of the set of choices that can be made by a recursive backtracking method at any point in the algorithm.
- 25.
- moves: NE N
- moves: N NE
- moves: N N E
- moves: N E N
- moves: E N N
Advertisement
Add Comment
Please, Sign In to add comment