[prev] 53 [next]

Exercise 11: BFS isPath() Function

As presented above, isPath() produces correct results.

However, it has a potential inefficiency.

What is the problem, and how could we fix it?

Hint: consider the following graph and isPath(a,e) ...

[Diagram:Pics/graphs/ispath-doubling.png]