Skip to content

Files

breadth-first-search

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 8, 2023
Mar 8, 2023

Given a binary tree, write a function to traverse the tree in a breadth first search (BFS) approach.

Sample Input

tree =    5
       /     \
      2       7
    /   \   /   \
   1     3 6     8

Sample Output

5 2 7 1 3 6 8