1 2

## 00: Tree from a list & flattening it back to a list in Java

Hierarchical data with parent & child relationships are very common, and Java collection does not have a Tree data structure, hence it is a popular interview question. Further questions include tree data structure processing using recursiion & iteration. A Tree data structure can be represented as shown below.

Step 1: A simple Node.java class that encapsulates its value, parent node id & if any child nodes.… Read more ...

Tags:

## 01: Tree flattening example in Java with Generics

Q. Traverse the tree in depth and return a list of all passed nodes. It should handle different data types as Double, String, etc. The interface for the tree node is

## 02: Tree structure – calculate average recursively & iteratively in Java

Q. Complete the following “TreeProcessingImpl” class ā¦.. so that the unit tests shown below pass? Skeleton Code

## 03: Tree traversal algorithms in Java

Q1. What are the different binary tree traversal mechanisms? A1. Traversing a tree means visiting all the nodes of a tree in order. Many different binary tree algorithms involve traversals. For example, if you wish to count the number of employees in an organizational chart you must visit each node….

## 04: Tree – Get root to leaf max sum in Java example

Q. Write code to traverse a tree and get the largest “root-to-leaf sum”? A “root-to-leaf sum” is a sum of the node values in a root-to-leaf path.

## 05: Is it a valid binary search tree (BST) ?

Q. Write code test if a given tree is a binary search tree (i.e. BST)? A. A binary search tree (BST) is a binary tree where each node satisfies the following conditions: 1) key in any node is larger than the keys in all nodes in that node’s left subtree…

## 06: Binary Tree – Sum Levels Java Example

Q. Write code to traverse a tree and return the sum of the values (Node.getValue()) of all nodes at the level N in the binary tree?

## 06: Binary Tree ā Get root to leaf max sum in Java example

Q. Write code to traverse a binary tree and get the largest “root-to-leaf sum”? A “root-to-leaf sum” is a sum of the node values in a root-to-leaf path.

## 07: Tree – Sum Levels Java example

Q. Write code to traverse a tree and return the sum of the values (Node.getValue()) of all nodes at the level N in the tree?

## 08: Part-1: Basic Java Tree structure interview questions and coding questions

Java does not have a Tree class but you can define one. In my 10+ years as a Java developer, I have rarely used a Tree structure,  but when I do use it I find it to be a bit more complicated than working with other data structure. I have…

1 2

### Prepare to fast-track & go places

FAQs are marked with š„ as some questions are not only more popular with the interviewers, but also required to build robust systems. If you are an interviewer, cover well rounded topics to judge real experience.

Don't be overwhelmed by the number of questions as the technology stacks are so vast. The quality of the answers you provide to some of the key technicalĀ & open-ended questions along with your soft skills & attitude will go a long way in getting the job offers.

Note: Some Q&As belong to more than one category.
Top