Given a binary tree, find all duplicate subtrees. For each duplicate subtrees, we only need to return the root node of any one of them. Two trees are duplicate if the...

Share

A leftist tree or leftist heap is a priority queue implemented with a variant of a binary heap. Every node has an s-value (or rank or distance) which is the distance ...

Share

Given a team of N players. How many minimum games are required to find second best player?
We can use adversary arguments based on tournament tree (Binary Heap).
Tou...

Share

Given a binary tree we need to check it has heap property or not, Binary tree need to fulfill following two conditions for being a heap –
It should be a compl...

Share

Given an array of n numbers, the task is to answer the following queries:
kthSmallest(start, end, k) : Find the Kth smallest
number in t...

Share

Consider a Binary Heap of size N. We need to find height of it.
Examples :
Input : N = 6
Output : 2
()
/
() ()
/ /
() () ()
...

Share

Given the level order traversal of a Complete Binary Tree, determine whether the Binary Tree is a valid Min-Heap
Examples:
Input : level = [10, 15, 14, 25, 30]
Output...

Share

Given a Binary Tree, convert it to a Circular Doubly Linked List (In-Place).
The left and right pointers in nodes are to be used as previous and next pointers respec...

Share

Asked by Varun Bhatia.
Question:
Write a recursive function treeToList(Node root) that takes an ordered binary tree and rearranges the internal pointers to make a cir...

Share

Given a ternary tree, create a doubly linked list out of it. A ternary tree is just like binary tree but instead of having two nodes, it has three nodes i.e. left, mi...

Share