mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 01:48:02 +00:00
Revised path exists challenge algorithm discussion.
This commit is contained in:
@@ -71,7 +71,11 @@
|
||||
"source": [
|
||||
"## Algorithm\n",
|
||||
"\n",
|
||||
"We use breadth-first search to determine the shortest path. Depth-first search is easier to implement with just straight recursion, but often results in a longer path.\n",
|
||||
"To determine if there is a path, we can use either breadth-first or depth-first search.\n",
|
||||
"\n",
|
||||
"Breadth-first search can also be used to determine the shortest path. Depth-first search is easier to implement with just straight recursion, but often results in a longer path.\n",
|
||||
"\n",
|
||||
"We'll use a breadth-first search approach:\n",
|
||||
"\n",
|
||||
"* Add the start node to the queue and mark it as visited\n",
|
||||
"* If the start node is the end node, return True\n",
|
||||
|
||||
Reference in New Issue
Block a user