# Coding Interview Club

Prepare for coding interviews in simple and structured steps

# Trees and Graphs

May 09, 2016 09:32am

Check if a Binary Tree is a Binary Search Tree (BST) using Property of Binary Tree: For a BST, all left nodes should be less than or equal to current node and current node must be less than all right nodes.

May 09, 2016 09:29am

Check if a Binary Tree is Balanced in O(N) time complexity.

Assumption: Heights of two subtrees of any node should never differ by more than one, to consider a tree as balanced.

May 09, 2016 09:28am

Create a binary search tree with minimal height from a sorted increasing order array.

May 09, 2016 01:52am

Recursively find the difference between the sum of nodes at odd levels and sum of nodes at even levels of a binary tree.

May 09, 2016 12:05am

Given a binary tree, create a linked list of all nodes at each level of binary tree using recursion.

If there are n levels, there will be n linked lists.

You can create an ArrayList of linked lists.

May 09, 2016 12:01am

Given a binary tree, create a linked list of all nodes at each level of binary tree without using recursion.

If there are n levels, there will be n linked lists.

You can create an ArrayList of linked lists.

May 08, 2016 11:07am

Given a binary tree with an integer data element; find all paths whose sum of data nodes will be equal to a given value.

Path can start or end anywhere in the tree.

Example: If the sum given is 5 and a  path is 2->3->1>-1....

Aug 13, 2016 03:44pm

Problem

Given a binary tree, find out if it is a binary search tree or not.

Approach 1

• You can traverse the tree in in-order way, and see if the elements are...