Skip to content
TutorialCup
  • Home
  • Tutorials
    • C
    • C++
    • DBMS
    • Java
    • Python
    • SQL
    • Testing
    • GitHub
    • Spring Boot
    • R
    • JavaScript
  • Interviews
    • Technical Interview Questions
    • Interview Questions

TutorialCup

  • Home
  • Tutorials
    • C
    • C++
    • DBMS
    • Java
    • Python
    • SQL
    • Testing
    • GitHub
    • Spring Boot
    • R
    • JavaScript
  • Interviews
    • Technical Interview Questions
    • Interview Questions

Maximum Depth of Binary Tree Leetcode Solution

Problem Statement In the problem a binary tree is given and we have to find out the maximum depth of the given tree. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 3 / …

Read more

Categories LeetCode Solutions Tags Adobe, Amazon, Binary Tree, Easy, Facebook, Microsoft, Recursion, Tree Traversal

Iterative Inorder Traversal of a Binary Tree

In “Iterative Inorder Traversal of a Binary Tree” problem we are given a binary tree. We need to traverse it in inorder fashion “iteratively”, without the recursion. Example 2 / \ 1 3 / \ 4 5 4 1 5 2 3 1 / \ 2 3 / \ 4 …

Read more

Categories Tree Interview Questions Tags Binary Tree, Medium, Tree Traversal

Morris Inorder Traversal

We can traverse a tree in the inorder fashion iteratively, using stack, but it consumes space. So, in this problem, we are going to traverse a tree without the linear space being used. This concept is called Morris Inorder Traversal or Threading in Binary trees. Example 2 / \ 1 …

Read more

Categories Tree Interview Questions Tags Medium, Tree, Tree Traversal

Sum of Left Leaves Leetcode Solutions

In this problem, we have to find the sum of all left leaves in a binary tree.  A leaf that is called a “Left Leaf” if it is a left child of any node in the tree. Example   2 / \ 4 7 / \ 9 4 Sum is 13 …

Read more

Categories LeetCode Solutions Tags Adobe, Easy, Tree, Tree Traversal

Morris Traversal

Morris traversal is a method to traverse the nodes in a binary tree without using stack and recursion. Thus reducing the space complexity to linear. Inorder Traversal Example 9 7 1 6 4 5 3 1           /    \         2    …

Read more

Categories Tree Interview Questions Tags Amazon, Facebook, Fourkites, Google, Medium, Microsoft, Tree, Tree Traversal

Kth ancestor of a node in binary tree

Problem Statement The problem “Kth ancestor of a node in binary tree” states that you are given a binary tree and a node. Now we need to find the kth ancestor of this node. An ancestor of any node is the nodes that lie on the path from the root …

Read more

Categories Tree Interview Questions Tags Amazon, Binary Tree, Google, Hard, Tree, Tree Traversal

Find postorder traversal of BST from preorder traversal

Problem Statement The problem “Find postorder traversal of BST from preorder traversal” states that you are given preorder traversal of a binary search tree. Then using the given input find the postorder traversal. Example preorder traversal sequence: 5 2 1 3 4 7 6 8 9 1 4 3 2 …

Read more

Categories Tree Interview Questions Tags Amazon, Binary Search Tree, Fourkites, Medium, PayU, Tree Traversal

Iterative Preorder Traversal

The problem “Iterative Preorder Traversal” states that you are given a binary tree and now you need to find the preorder traversal of the tree. We are required to find the preorder traversal using iterative method and not the recursive approach. Example   5 7 9 6 1 4 3 …

Read more

Categories Tree Interview Questions Tags Amazon, Easy, Google, JP Morgan, Microsoft, Morgan Stanley, Tree, Tree Traversal, Uber

Boundary Traversal of binary tree

Problem Statement The problem “Boundary Traversal of binary tree” states that you are given a binary tree. Now you need to print the boundary view of a binary tree. Here boundary traversal means that all the nodes are shown as the boundary of the tree. The nodes are seen from …

Read more

Categories Tree Interview Questions Tags Accolite, Amazon, Binary Tree, Hike, Kritikal Solutions, Medium, Microsoft, Morgan Stanley, PayU, Snapdeal, Tree, Tree Traversal

Diagonal Traversal of Binary Tree

Problem Statement The problem “Diagonal Traversal of Binary Tree” states that you are given a binary tree and now you need to find the diagonal view for the given tree. When we see a tree from the top-right direction. The nodes which are visible to us is the diagonal view …

Read more

Categories Tree Interview Questions Tags Amazon, Binary Tree, Factset, Fanatics, Fourkites, Medium, Oracle, PayU, Quora, Tree, Tree Traversal
Post navigation
Older posts
1 2 3 Next →

Search




© TutorialCup 2021 | Feeds | Privacy Policy | Terms | Contact Us | Linkedin | About Us
Scroll back to top
Next Page »