CS125 Section 12 aka "Recursion II" (Solution)
1. Recursive searching on Tree data structures
Challenge: Write a maxValuePath recursive function that sums the values held by a set of tree nodes along one
set of edges. For example, in the graph shown at th
Midterm 2 Review
The exam will cover Chapters 4 (Functions, injections, surjections, bijections, cardinality of sets
etc.) and 13 (sequences, convergence, bounded, monotone etc.).
As I stated in class, the rst problem on the test will be to state the deni
CS125 Section 13 SOLUTION aka "Advanced Recursion"
Conquering recursion in the finals.
1. Recursion on Linked Lists
public class Link cfw_
public Link next; / null if this is the last link
public int value;
public Link(Link n, int v) cfw_next = n; value =
Part 1: equals()
CS125 Section 15 Solution
public class Ghostcfw_
private int x, y, dir;
/ returns false iff it has any of x, y, dir values different.
public boolean equals(Ghost other) cfw_
if(other = null) return false; / Not necessary for this Q, just