Binary Tree Patterns | DSA

Shiva KrishnaShiva Krishna
2 min read

1. Tree Traversal Techniques

  • Inorder Traversal (Recursive, Iterative)

  • Preorder Traversal (Recursive, Iterative)

  • Postorder Traversal (Recursive, Iterative)

  • Level Order Traversal (BFS Approach)

  • Zigzag Level Order Traversal

  • Boundary Traversal of Binary Tree

  • Morris Inorder

  • Morris Preorder


2. Tree Properties

  • Height of a Binary Tree

  • Check if a Binary Tree is Balanced

  • Diameter of a Binary Tree

  • Check if Two Trees are Identical

  • Maximum width of Binary Tree

  • Check Children sum property

  • Count nodes in complete Tree


3. Tree Views

  • Top View

  • Bottom View

  • Right View

  • Left View

  • Diagonal View of a Binary Tree



5. Tree Ancestor Problems

  • Lowest Common Ancestor (LCA) in a Binary Tree

  • Ancestors in Binary Tree

  • Maximum Difference Between Node and Ancestor


6. Tree Constructions

  • Construct Binary Tree from Preorder and inorder

  • Construct Binary Tree from Postorder and inorder

  • Construct String from Binary Tree

  • Convert a Binary Tree to its Mirror Tree

  • Flatten Binary Tree to Linked List


7. Serialize and Deserialize

  • Serialize and Deserialize a Binary Tree

  • Verify Preorder Serialization of a Binary Tree

1
Subscribe to my newsletter

Read articles from Shiva Krishna directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shiva Krishna
Shiva Krishna