From charlesreid1

Breadth-first search using queues

When doing BFS, use a queue. The pseudocode looks like this:

add root to queue
while queue not empty:
    remove next item from queue
    perform search action on item
    add children queue

Flags