##
K’th smallest element in BST using O(1) Extra Space
July 16, 2015

Given a Binary Search Tree (BST) and a positive integer k, find the k’th smallest element in the Binary Search Tree.

July 16, 2015

Given a Binary Search Tree (BST) and a positive integer k, find the k’th smallest element in the Binary Search Tree.

July 4, 2015

Given a Binary Search Tree (BST) of integer values and a range [low, high], return count of nodes where all the nodes under that node (or subtree rooted with that node) lie in the given range.

July 2, 2015

Given a Binary Search Tree (BST) and a range, count number of nodes that lie in the given range.

May 28, 2015

Design a data structure to do reservations of future jobs on a single machine under following constraints. 1) Every job requires exactly k time units of the machine. 2) The machine can do only one job at a time.

May 11, 2015

In a Binary Search Tree (BST), all keys in left subtree of a key must be smaller and all keys in right subtree must be greater. So a Binary Search Tree by definition has distinct keys.

April 1, 2015

Hash Table supports following operations in Θ(1) time.

March 19, 2015

Given a Binary Search Tree (BST) and a positive integer k, find the k’th largest element in the Binary Search Tree.

December 8, 2014

Given n appointments, find all conflicting appointments.

July 25, 2014

I recently encountered with a question in an interview at e-commerce company. The interviewer asked the following question:

June 27, 2014

Given a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node.

September 12, 2013

Given a Binary Search Tree (BST), modify it so that all greater values in the given BST are added to every node. For example, consider the following BST.