Write an efficient algorithm to construct a full binary tree from a sequence of keys representing preorder traversal, and a boolean array which determines if the corresponding key in the preorder traversal is a leaf node or an internal node.
Given a distinct sequence of keys, check if it can represent a preorder traversal of a binary search tree (BST).
Write an efficient algorithm to convert a ternary tree into a doubly linked list. A ternary tree is a tree data structure in which each node has at most three child nodes distinguished as left, mid and right.
A full binary tree is a tree in which every node has either 0 or 2 children. Write an efficient algorithm to construct a full binary tree from given preorder and postorder sequence.
In this post, we will see the difference between Depth first search (DFS) and Breadth first search (BFS) algorithm which are used to traverse/search tree or graph data structure.
Given a BST, count subtrees in it whose nodes lies within a given range. For example, consider below BST. The number of subtrees with nodes in the range [5, 20] are 6.
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.