Given a Binary Search Tree (BST) and a positive integer k, find the k’th smallest element in the Binary Search Tree.
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.
Given a Binary Search Tree (BST) and a range, count number of nodes that lie in the given range.
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.
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.
Hash Table supports following operations in Θ(1) time.
Given a Binary Search Tree (BST) and a positive integer k, find the k’th largest element in the Binary Search Tree.
Given n appointments, find all conflicting appointments.
I recently encountered with a question in an interview at e-commerce company. The interviewer asked the following question:
Given a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node.
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.