Determine if a binary tree satisfies the height-balanced property of a red–black tree
Write an efficient algorithm to determine if a binary tree satisfies the height-balanced property of the red–black tree or not.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedWrite an efficient algorithm to determine if a binary tree satisfies the height-balanced property of the red–black tree or not.
Write an efficient algorithm to construct a full binary tree from a sequence of keys representing preorder traversal and a boolean array that 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).
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 a given preorder and postorder sequence.
This post will cover the difference between the Depth–first search (DFS) and Breadth–first search (BFS) algorithm used to traverse/search tree or graph data structure.
Given a BST, count subtrees in it whose nodes lie within a given range.
Given an inorder sequence of a binary tree, find all possible binary trees having that same inorder traversal.
Given a dictionary of ancient origin where the words are arranged alphabetically, find the correct order of alphabets in the ancient language.
Write an efficient algorithm to construct a Cartesian tree from inorder traversal. A Cartesian tree is a binary tree with the heap property: the parent of any node has a smaller value than the node itself.
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 binary tree where each node has one extra pointer next, set it to the inorder successor for all binary tree nodes.