Check whether the leaf traversal of given binary trees is the same or not
Given two binary trees, check whether the leaf traversals of both trees are the same or not.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven two binary trees, check whether the leaf traversals of both trees are the same or not.
Construct an expression tree from a given postfix notation and print the infix notation. The binary expression tree is a binary tree whose leaves are operands, such as constants or variable names, and the other nodes contain operators.
Given a binary tree, extract all its leaves into a doubly-linked list, i.e., remove all leaf nodes from the binary tree and construct a doubly linked list out of them.
Given a binary tree, write an efficient algorithm to find the maximum path sum between any two nodes in it. The path can start and end at any node in the tree and need not go through the root.
Given a binary tree, find its minimum depth. The minimum depth is the total number of nodes along the shortest path from the root node down to the nearest leaf node.
An m-ary tree is a tree in which each node has no more than m children. Given an m-ary tree, write an efficient algorithm to convert the tree to its mirror.
Write an efficient algorithm to invert alternate levels of a perfect binary tree.
Write an efficient algorithm to construct a binary tree from given inorder and level-order sequence.
Write an efficient algorithm to construct a binary tree from the given inorder and postorder traversals.
Given a binary tree, convert it into a doubly-linked list following the spiral order.
This post will explore a threaded binary tree and convert a normal binary tree into a threaded binary tree.
Write an efficient code to clone a binary tree with each node containing an additional random pointer. The random pointer can point to any random node of the binary tree or can be null.