Binary-Tree

Minimum Cost Tree From Leaf Values

LeetCode problem #1130

Binary Tree Inorder Traversal

Traverse a binary tree in inorder (left -> root -> right)

Binary Tree Preorder Traversal

Traverse a binary tree in preorder (root -> left -> right)

Boundary Traversal of Binary Tree

Traverse the boundary of a binary tree in anti-clockwise direction.

Construct Binary Tree from Preorder and Inorder Traversal

Construct a binary tree from preorder and inorder traversal sequences.

Count Good Nodes in Binary Tree

Count the number of nodes in a binary tree where the path from root to that node has no nodes with values greater than the current node.

Diameter of Binary Tree

Find the diameter (longest path) of a binary tree.

Flatten Binary Tree to Linked List

Flatten a binary tree into a linked list in-place using preorder traversal.

Invert Binary Tree

Invert (mirror) a binary tree by swapping left and right children

LC 103 Zigzag Level Order Traversal (BFS) Guide

Solve binary tree zig zag/spiral traversal with optimal BFS + deque. O(n) time, O(w) space. Step-by-step for interviews—practice now.

Maximum Depth of Binary Tree

Find the maximum depth (height) of a binary tree

Postorder Traversal

Traverse binary tree in postorder (left, right, root)

Print All Root-to-Leaf Paths

Print all root-to-leaf paths in a binary tree

Serialize and Deserialize Binary Tree

Serialize a binary tree to a string and deserialize it back to the original tree

Vertical Order Traversal of Binary Tree

Traverse a binary tree vertically and return nodes by columns