~/ learn/ comp-456/ cards/ Breadth-first search (FIFO queue)
1 of 4

BFS open/closed pseudocode (Luger): OPEN as a FIFO queue

BFS open/closed pseudocode (Luger): OPEN as a FIFO queue

Answer

OPEN := [Start] CLOSED := [] while OPEN not empty: X := remove_front(OPEN) if goal(X): return path(X) add X to CLOSED OPEN := OPEN ++ (children(X) not in OPEN or CLOSED)

remove_front + append children to the back is the FIFO discipline: earliest-discovered states are expanded earliest, so the search clears a whole depth level before going deeper. CLOSED prevents re-expansion.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/1c2f44cb-da6c-4363-ab31-2566d120352c/flashcard utf-8 LF