← 모든 글
개발

Binary tree traversal DFS BFS

아직 한국어 번역이 없습니다. 영문 원문을 표시합니다.

Binary tree traversal

DFS

preorder

Root first, then left subtree, and then right subtree.

inorder

Left subtree first, then root, and then right subtree.

postorder

Left subtree first, then right subtree, and then root.

BFS

level order traversal

Start from root node and traverse its neighbours, and its second level neighbours and so on.