Skip to content

q [terminology]

Terminology

Usage

  • Use for a single queue in a compact BFS implementation.
  • Prefer queue when several queues or worklists coexist.
  • Keep queue-specific operations close enough that the data structure remains obvious.
q = deque([root])

while q:
    node = q.popleft()