Revised path exists challenge algorithm discussion.

This commit is contained in:
Donne Martin
2015-08-16 08:23:26 -04:00
parent 6b269d0f45
commit 82b74ca7b4

View File

@@ -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",