This repository contains solutions to various tree-related interview questions implemented in Java. Each file addresses a specific problem related to binary trees and binary search trees (BSTs). Here's a brief overview of the files:
- Ancestors_in_BT.java: Find ancestors of a given node in a binary tree.
- BST_FromPreOrder.java: Construct a BST from a given preorder traversal sequence.
- CheckSubTree.java: Check if one binary tree is a subtree of another.
- InOrder.java, PostOrder.java, PreOrder.java: Implementations of in-order, post-order, and pre-order traversals of a binary tree.
- MaximumSumof_Non_adjacent_nodes.java: Find the maximum sum of non-adjacent nodes in a binary tree.
- PreorderToBST.java: Convert a given preorder traversal of a BST into the BST.
- RootToLeafPathSum.java: Find paths in a binary tree that sum up to a given value.
- Search_inBST.java: Search for a node in a binary search tree.
These solutions are designed to demonstrate efficient handling of common tree operations and are useful for preparing for technical interviews focusing on data structures and algorithms.