(BFS)
DFS (depth-first algorithm)
topic
DFS is recursive
- Recursive to realize DFS makes the code look simple
- Recursive when needed the current state of the process variables and the stack is pressed into the inside of the system
- Push and pop the stack needs more time, if necessary pushed deep stacks, can cause inefficiencies
DFS non-recursive
Stack data structure also supports push and pop operations
You can use the stack to improve operational efficiency
Using the shortest path selecting DFS
Breadth-first search (BFS) (Shortest Path)
- BFS is generally used to solve the shortest path problem
- Breadth-first search is from the starting point, layer by layer be
- Point distance among the number of steps the starting point of each layer are the same
- Binary tree traversal sequence