Solution: Count the Paths Between Two Nodes
This review provides the solution to printing all the paths between two nodes.
We'll cover the following...
We'll cover the following...
Solution
Explanation
Let’s try to think recursively about the solution to this problem. Take a concrete example where the source node has three adjacent nodes. These nodes report that they have 2, 3, and 4 paths to the destination node, respectively. Then, the total number of paths from the source node to the destination should be 2 + 3 + 4 = 9. Therefore, for any given node, the recursive way to compute the number of paths to ...