Find all possible binary trees having the same inorder traversal
Given an inorder sequence of a binary tree, find all possible binary trees having that same inorder traversal.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an inorder sequence of a binary tree, find all possible binary trees having that same inorder traversal.
Given a linked list that can grow in both horizontal and vertical directions (right and down), flatten it into a sorted singly linked list provided that each horizontal and vertical list is already sorted.
Given a dictionary of ancient origin where the words are arranged alphabetically, find the correct order of alphabets in the ancient language.
Given a distinct sequence of keys representing the postorder traversal of a binary search tree, construct a BST from it.
Given a distinct sequence of keys representing the preorder sequence of a binary search tree (BST), construct a BST from it.
Given a stack, sort it using recursion. The use of any other data structures (like containers in STL or Collections in Java) is not allowed.
Given an M × N matrix, count the number of different ways to reach the bottom-right corner of a matrix from its top-left corner with exactly k turn allowed and using only the directions right and down.
In this post, we will see how to sort N^2 numbers in increasing order using an N × N Young tableau in O(N^3) time.
An M × N Young tableau is an M × N matrix such that the entries of each row are sorted from left to right and the entries of each column are sorted from top to bottom. Some entries of a Young tableau may be infinity, which indicates an empty entry.
Given a set of rectangular 3D boxes (cuboids), create a stack of boxes as tall as possible and return the maximum height of the stacked boxes.
Given a binary tree, write an efficient algorithm to link nodes at the same level in the form of a linked list like structure.
This post will implement a treap data structure, a combination of a binary search tree and a heap, and perform basic operations like insert, search, and delete on it.