Trace the method isPathwith the map in Figure 5-6 for the following requests. Show the recursive calls and the returns from each.
What will be an ideal response?
```
• Fly from A to B.
isPath(A, B)
markVisited(A)
foundDestination = false
nextCity = B
foundDestination = isPath(B, B)
markVisited(B)
foundDestination = true
return true
foundDestination = true
return true
• Fly from A to D.
isPath(A, D)
markVisited(A)
foundDestination = false
nextCity = B
foundDestination = isPath(B, D)
markVisited(B)
foundDestination = false
nextCity = D
foundDestination = isPath(D, D)
markVisited(D)
foundDestination = true
return true
foundDestination = true
return true
foundDestination = true
return true
• Fly from C to G.
isPath(C, G)
markVisited(C)
foundDestination = false
nextCity = D
foundDestination = isPath(D, G)
markVisited(D)
foundDestination = false
nextCity = F
foundDestination = isPath(F, G)
markVisited(F)
foundDestination = false
nextCity = G
foundDestination = isPath(G, G)
markVisited(G)
foundDestination = true
return true
foundDestination = true
return true
foundDestination = true
return true
foundDestination = true
return true
```
You might also like to view...
A class that implements an interface but does not declare all of the interface’s methods must be declared:
a) public b) interface c) abstract d) final
In the function call
doesSomething (7, x, p); what are 7, x and p called?
Why can setting the CentOS 7 SUID bit to s be dangerous?
What will be an ideal response?
One purpose of a database is to store data so that information can be obtained easily by asking questions
Indicate whether the statement is true or false