Review: Binary Tree Problems

Many binary tree problems are about how to traversal it. In both recursive or non-recursive ways.

Binary Tree Traversal: Preorder, Inorder, Postorder, Level Order, Vertical Order, Right-Middle-Left, etc.

Only get the rightmost node at each level. Only get the leftmost node at each level, etc.

We might also see interesting requirements about updating binarytree. e,g, add a pointer to next, correct two nodes, delete a node, etc.

Personally I like level-order (or BFS) very much.
(See all bfs problems: #bfs)

Q: How to time complexity for tree problems?

Q: Do you know the difference between level-order vs BFS(Breadth-first search)?

level-order traversal is the same as breadth-first traversal. 
There are many reasons to traverse something, it doesn't just have 
to be to search, as breadth-first search seems to imply, although 
many (or most) don't make that distinction and use the terms interchangeably.

From link:

Examine previous/next node for in-order traversal. Closest Binary Search Tree Value.

The most impressive problems to me:

See all binarytree problems: #binarytree.

See more blog_posts.


Share It, If You Like It.

Leave a Reply

Your email address will not be published.