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 - queues==
==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