##
Check if each internal node of a BST has exactly one child
August 5, 2012

Given Preorder traversal of a BST, check if each non-leaf node has only one child. Assume that the BST contains unique entries.

August 5, 2012

Given Preorder traversal of a BST, check if each non-leaf node has only one child. Assume that the BST contains unique entries.

June 15, 2012

Given a Binary Tree, convert it to a Binary Search Tree. The conversion must be done in such a way that keeps the original structure… Read More »

June 1, 2012

Given two Binary Search Trees(BST), print the elements of both BSTs in sorted form. The expected time complexity is O(m+n)

March 30, 2012

You are given two balanced binary search trees e.g., AVL or Red Black Tree. Write a function that merges the two given balanced BSTs into… Read More »

February 17, 2012

Given a Binary Tree, write a function that returns the size of the largest subtree which is also a Binary Search Tree (BST). If the… Read More »

January 18, 2012

Given a sorted array. Write a function that creates a Balanced Binary Search Tree using array elements.

January 17, 2012

Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as… Read More »

March 3, 2011

Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Print all the keys of tree… Read More »

February 15, 2011

Given root of binary search tree and K as input, find K-th smallest element in BST.

February 11, 2011

In Binary Tree, Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the… Read More »

December 13, 2010

Given an array that stores a complete Binary Search Tree, write a function that efficiently prints the given array in ascending order.

May 26, 2010

Total number of possible Binary Search Trees with n different keys = Catalan number Cn = (2n)!/(n+1)!*n!

November 21, 2009

A binary search tree (BST) is a node based binary tree data structure which has the following properties.

September 3, 2009

This is quite simple. Just traverse the node from root to left recursively until left is NULL. The node whose left is NULL is the… Read More »