Some important Tree functions
- build tree -------> new node creation by recursive calls
- level order traversal -------> Queue
- inorder recursive -------> Recursion
- inorder iterative -------> Stack
- preorder recursive -------> Recursion
- postorder recursive -------> Recursion
- height O(n^2) -------> Recursive calls
- height O(n) -------> level order traversal
- diameter O(n^2) -------> Dia left -- Dia Right -- height(root)
- diameter O(n) -------> using pair to store height (avoid recursive calls)
- check balanced O(n^2) -------> condition = | H (left) - H (right) | <= 1
- check balanced O(n) -------> using pair to store height
- identical tree -------> inorder traversal & checking data elements
- sum tree
- top view
- bootom view
- left view
- right view
- diagnol traversal
- zig-zag traversal
- vertical order taversal
- boundary traversal
- k-sum paths
- lowest common ancestor (LCA)
- kth ancestor -----------> 2 approaches -> (vector & baktracking) and (reursion k--)
- sum of longest bloodline
- max sum of non - adjacent nodes
- construct binary tree from preorder and inorder
- construct binary tree from postorder and inorder
- minimum time to burn a tree
- Morris Inorder traversal (Threaded Binary Tree)
- Morris Preorder traversal
- Flatten a binary tree to linked list (Recursive)
- Flatten a binary tree to linked list (Iterative) (Stack)
- Flatten a binary tree to linked list (iterative) (Moriss-Traversal)
-> Check Complete Binary Tree https://practice.geeksforgeeks.org/problems/complete-binary-tree/1
-> Symmetric Tree https://practice.geeksforgeeks.org/problems/symmetric-tree/1
-> Mirror Tree https://practice.geeksforgeeks.org/problems/mirror-tree/1