Skip to content

Latest commit

 

History

History

10. Binary Tree

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Binary Tree

  1. Level Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 1.level-order-traversal-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Using Queue O(N) O(N) Link
  2. Level Order Build Tree Problem.
    Question
    Solution
    Command:-

    $ go run 2.level-order-build-tree-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Using Queue O(N) O(N) Link
  3. Recursive Pre Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 3.preorder-traversal-recursive-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(N) Link
  4. Iterative Pre Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 4.preorder-traversal-iterative-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Iterative using stack O(N) O(N) Link
  5. Recursive In Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 5.inorder-traversal-recursive-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(N) Link
  6. Iterative In Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 6.inorder-traversal-iterative-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Iterative using stack O(N) O(N) Link
  7. Recursive Post Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 7.postorder-traversal-recursive-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(N) Link
  8. Recursive Post Order Traversal Problem.
    Question
    Solution
    Command:-

    $ go run 8.postorder-traversal-iterative-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Iterative using stack O(N) O(N) Link
  9. Height of Binary Tree Problem.
    Question
    Solution
    Command:-

    $ go run 9.height-of-tree-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(N) Link
  10. Diameter of Binary Tree Problem.
    Question
    Solution O(N^2)
    Solution O(N)
    Command:-

    $ go run 10.diameter-of-tree-o(n^2)-solution.go < 0.input-file.txt
    
    $ go run 10.diameter-of-tree-o(n)-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Calculating height and diameter in different call O(N^2) O(N) Link
    Calculating height and diameter in same call O(N) O(N) Link
  11. Replace Descendants Sum Tree Problem.
    Question
    Solution
    Command:-

    $ go run 11.replace-with-descendants-sum-solution.go
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(N) Link
  12. Height Balanced Tree Problem.
    Question
    Solution O(N^2)
    Solution O(N)
    Command:-

    $ go run 12.is-balanced-tree-o(n^2)-solution.go < 0.input-file.txt
    
    $ go run 12.is-balanced-tree-o(n)-solution.go < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Calculating height and balance check in different call O(N^2) O(1) Link
    Calculating height and balance check in same call O(N) O(1) Link
  13. Max Sub Set Sum Tree Problem.
    Question
    Solution
    Command:-

    $ go run 13.max-sub-set-sum-solution.go  < 0.input-file.txt
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(1) Link
  14. Nodes At Distance k from target Node (Sorted) Problem.
    Question
    Solution
    Command:-

    $ go run 14.nodes-at-kth-distance-from-target-node-solution.go
    Method TimeComplexity SpaceComplexity Source
    Recursive O(N) O(1) Link