Binary Tree
- 29 January
Count subtrees with Sum equal to target in binary tree
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see about how to count subtrees with Sum equal to target in binary tree Problem Given a Binary tree and an integer. You need to find the number of subtrees having the […]
- 17 November
Lowest Common Ancestor (LCA) for n-ary Tree
If you want to practice data structure and algorithm programs, you can go through Java coding interview questions. In this post, we will see about Lowest Common Ancestor for n-ary Tree. Problem Given a n-ary tree also known as a Generic Tree and also two nodes. You need to find the Lowest common ancestor of the […]
- 16 September
Check if a binary tree is binary search tree or not in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see how to check if given binary tree is binary search tree or not. This is one of important interview questions on binary tree. We will see two approaches to check if […]
- 16 April
Delete a node from binary search tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see how to delete a node from binary search tree. There are two parts to it. Search the node After searching that node, delete the node. There are three cases which we […]
- 14 April
Lowest Common Ancestor (LCA) of binary tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see how to find lowest common ancestor(LCA) of two nodes in binary tree. Lets understand with example. As you can see here, LCA is nothing but lowest common parent of two nodes. […]
- 13 April
Boundary traversal of binary tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see boundary traversal of binary tree in java. Lets understand boundary traversal of binary tree with example: If you look closely to above diagram, boundary traversals can be divided into three essential […]
- 07 April
Reverse level order traversal of binary tree in java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is part of java binary tree tutorial. In this post, we will see about Reverse Level Order binary tree traversal in java. In previous post, we have already seen Level order traversal. In reverse level order […]
- 07 April
Find Maximum Element in Binary Tree in Java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. 1. Overview In this article, we will explore how to find the maximum element in a binary tree in Java using recursive and iterative solutions. 2. Introduction to Problem Statement Given a binary tree as below: Maximum […]
- 17 November
Get Level of A Node in Binary Tree in Java
If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. 1. Overview In this article, we will explore how to get the level of node in a binary tree in Java using recursive and iterative solutions. 2. Introduction to Problem Statement We will search for a node […]