Skip to content
arshpreet8051Public

About

Some important Tree functions

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree

Some important Tree functions

  1. build tree -------> new node creation by recursive calls
  2. level order traversal -------> Queue
  3. inorder recursive -------> Recursion
  4. inorder iterative -------> Stack
  5. preorder recursive -------> Recursion
  6. postorder recursive -------> Recursion
  7. height O(n^2) -------> Recursive calls
  8. height O(n) -------> level order traversal
  9. diameter O(n^2) -------> Dia left -- Dia Right -- height(root)
  10. diameter O(n) -------> using pair to store height (avoid recursive calls)
  11. check balanced O(n^2) -------> condition = | H (left) - H (right) | <= 1
  12. check balanced O(n) -------> using pair to store height
  13. identical tree -------> inorder traversal & checking data elements
  14. sum tree
  15. top view
  16. bootom view
  17. left view
  18. right view
  19. diagnol traversal
  20. zig-zag traversal
  21. vertical order taversal
  22. boundary traversal
  23. k-sum paths
  24. lowest common ancestor (LCA)
  25. kth ancestor -----------> 2 approaches -> (vector & baktracking) and (reursion k--)
  26. sum of longest bloodline
  27. max sum of non - adjacent nodes
  28. construct binary tree from preorder and inorder
  29. construct binary tree from postorder and inorder
  30. minimum time to burn a tree
  31. Morris Inorder traversal (Threaded Binary Tree)
  32. Morris Preorder traversal
  33. Flatten a binary tree to linked list (Recursive)
  34. Flatten a binary tree to linked list (Iterative) (Stack)
  35. Flatten a binary tree to linked list (iterative) (Moriss-Traversal)

-----------------------------------------------------------------------

Extra Questions:

-> 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

About

Some important Tree functions

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages