mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-10 19:01:13 -04:00
fix(curriculum): coding interview breadth/depth first images (#57124)
This commit is contained in:
@@ -1159,7 +1159,8 @@
|
||||
"title": "Coding Interview Prep",
|
||||
"intro": [
|
||||
"If you're looking for free coding exercises to prepare for your next job interview, we've got you covered.",
|
||||
"This section contains hundreds of coding challenges that test your knowledge of algorithms, data structures, and mathematics. It also has a number of take-home projects you can use to strengthen your skills, or add to your portfolio."
|
||||
"This section contains dozens of coding challenges that test your knowledge of algorithms, data structures, and mathematics. It also has a number of take-home projects you can use to strengthen your skills, or add to your portfolio.",
|
||||
"This work incorporates material from <a href=\"https://www.wikipedia.org/\" target=\"_blank\">Wikipedia</a>, which is licensed under the <a href=\"https://creativecommons.org/licenses/by-sa/4.0/\" target=\"_blank\">Creative Commons Attribution-ShareAlike License 4.0</a>. The original content might have been modified and adapted. For the unaltered version and additional details, see the original page on <a href=\"https://www.wikipedia.org/\" target\"_blank\">Wikipedia</a>."
|
||||
],
|
||||
"note": "The Project Euler Project and Rosetta Code have been moved to their own courses. Go back to the curriculum to see the list of courses we offer.",
|
||||
"blocks": {
|
||||
|
||||
@@ -16,7 +16,8 @@ This algorithm starts at one node and visits all its neighbors that are one edge
|
||||
|
||||
An important data structure that will help implement the breadth-first search algorithm is the queue. This is an array where you can add elements to one end and remove elements from the other end. This is also known as a <dfn>FIFO</dfn> or <dfn>First-In-First-Out</dfn> data structure.
|
||||
|
||||
Visually, this is what the algorithm is doing. 
|
||||
Visually, this is what the algorithm is doing:
|
||||
<img alt="animation showing the breadth first search algorithm" src='https://cdn.freecodecamp.org/curriculum/coding-interview-prep/breadth-first-search.gif'>
|
||||
|
||||
The grey shading represents a node getting added into the queue and the black shading represents a node getting removed from the queue. See how every time a node gets removed from the queue (node turns black), all their neighbors get added into the queue (node turns grey).
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Once it reaches one end of a path, the search will backtrack to the last node wi
|
||||
|
||||
The animation below shows how the algorithm works. The algorithm starts with the top node and visits the nodes in the numbered order.
|
||||
|
||||
<img alt="" src='https://camo.githubusercontent.com/aaad9e39961daf34d967c616edeb50abf3bf1235/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f372f37662f44657074682d46697273742d5365617263682e676966'>
|
||||
<img alt="animation showing the depth first search algorithm" src='https://cdn.freecodecamp.org/curriculum/coding-interview-prep/depth-first-search.gif'>
|
||||
|
||||
Notice how, unlike breadth-first search, every time a node is visited, it doesn't visit all of its neighbors. Instead, it first visits one of its neighbors and continues down that path until there are no more nodes to be visited on that path.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user