Write an efficient algorithm to construct a Cartesian tree from in-order traversal. A Cartesian tree is a binary tree with the heap property: the parent of any node has smaller value than the node itself.
Given a distinct sequence of keys which represents postorder traversal of a binary search tree, construct the tree from the postorder sequence.
Given a distinct sequence of keys which represents preorder traversal of a binary search tree (BST), construct the tree from the postorder sequence.
Given a M x N boggle board, find list of all possible words that can be formed by a sequence of adjacent characters on the the board.
Given a binary tree where each node has one extra pointer next, set next pointer to inorder successor for all nodes in the binary tree.
Given a binary tree, efficiently print all nodes between two given levels in a binary tree. The nodes for any level should be printed from left to right.
Given a binary tree, calculate the difference between sum of all nodes present at odd levels and sum of all nodes present at even level.
Given a binary tree, print its nodes in vertical order. Assume that the left and right child of a node makes 45 degree angle with the parent.
Given a binary tree, write an efficient algorithm to link nodes at the same level in the form of a linked list like structure.
In this post, we will implement Treap Data Structure and perform basic operations like insert, search and delete on it.
Write an efficient algorithm to find preorder traversal of a binary tree from its inorder and postorder sequence without constructing the tree.
Given a binary search tree, modify it such that every key is updated to contain sum of all greater keys present in BST.