BFS: Difference between revisions
From charlesreid1
(Created page with "==Breadth-first search - queues== When doing BFS, use a queue. Add the root node to the queue. While the queue is not empty: remove item from queue, perform action on i...") |
No edit summary |
||
| Line 1: | Line 1: | ||
==Breadth-first search | ==Breadth-first search using queues== | ||
When doing BFS, use a queue. | When doing BFS, use a queue. | ||
| Line 12: | Line 12: | ||
add children to queue. | add children to queue. | ||
==Flags== | |||
{{TreesFlag}} | |||
[[Category:Queues]] | |||
[[Category:Trees]] | |||
[[Category:Traversal]] | |||
[[Category:Algorithms]] | |||
Revision as of 20:03, 11 June 2017
Breadth-first search using queues
When doing BFS, use a queue.
Add the root node to the queue.
While the queue is not empty:
remove item from queue,
perform action on item,
add children to queue.
Flags
| Trees Part of Computer Science Notes
Series on Data Structures Abstract data type: Trees/ADT Concrete implementations: Trees/LinkedTree · Trees/ArrayTree · SimpleTree
Tree Traversal Preorder traversal: Trees/Preorder Postorder traversal: Trees/Postorder In-Order traversal: Binary Trees/Inorder Breadth-First Search: BFS Breadth-First Traversal: BFT Depth-First Search: DFS Depth-First Traversal: DFT OOP Principles for Traversal: Tree Traversal/OOP · Tree Traversal/Traversal Method Template Tree operations: Trees/Operations Performance · Trees/Removal
Tree Applications Finding Minimum in Log N Time: Tree/LogN Min Search
Abstract data type: Binary Trees/ADT Concrete implementations: Binary Trees/LinkedBinTree · Binary Trees/ArrayBinTree Binary Trees/Cheat Sheet · Binary Trees/OOP · Binary Trees/Implementation Notes
|