// Chap 6, p 293 boolean IsPath(int OriginCity, int DestCity, mapClass M) // recursive version { int NextCity; boolean Success, Done; // mark the current city as visited M.MarkVisited(OriginCity); // base case: the destination is reached if (OriginCity == DestCity) return TRUE; else // try a flight to each unvisited city { Done = FALSE; M.GetNextCity(OriginCity, NextCity, Success); while (Success && !Done) Done = IsPath(NextCity, DestCity, M); return Done; } // end if } // end IsPath