DFS

Find ceil value of input data in binary search tree in java (DFS/Example)

Given the binary search tree, we need to find the Ceil value of given input data.
What is Ceil value ? The smallest value just greater than or equal to given input data. We have already discussed about Floor of input data in BST. The logical flow of ceil value in BST is exactly same as that floor value. Let us find Ceil value for BST shown in Fig 1.

Check given binary trees are Isomorphic in java (recursive / examples)

We are given two binary tree, we need to find out whether one binary tree is Isomorphic of other binary tree. What is Isomorphic meaning? As per English dictionary meaning is “being of identical or similar form, shape, or structure”. By apply above definition to our problem statement, If given binary have identical or similar form or shape or structure to another binary tree, we can say that trees are isomorphic.

Find InOrder predecessor in binary search tree (BST) in java (examples)

Predecessor of any node is the previous node of binary traversal. Let us take an example to understand the inorder predecessor in binary search tree. We have already discussed about the inorder successor. The logical flow of inorder predecessor and inorder successor is same. If we understand any one of them, other can be solved in similar manner.

Find maximum sum, root to leaf path in binary tree (Java/ recursive/ example)

Given the binary tree, There are multiple paths (equal to number of leaf nodes) exist from root to leaf nodes, We need to calculate the sum of all nodes in each root to leaf path, then we need to print the maximum sum and the corresponding path. Let us take the example to elaborate our problem statement.

Number of nodes or size of binary tree in java (DFS / examples)

Given the binary tree, we need to find number of nodes in the given binary tree. To count the number of nodes in binary tree, we need to visit all the nodes at least once. We have counted the number of nodes without recursion using level order traversal in this post.

Scroll to Top