## Clone a Binary Tree with Random Pointers

Given a Binary Tree where every node has following structure. struct node { int key; struct node *left,*right,*random; } The random pointer points to any… Read More »

## Microsoft Interview | Set 33 (On-Campus for Internship)

Recently Microsoft IDC had visited our Campus for Intenship. There were 6 rounds in total for me. Objective Round :- The objective round was taken… Read More »

## Convert left-right representation of a binary tree to down-right

Left-Right representation of a binary tree is standard representation where every node has a pointer to left child and another pointer to right child. Down-Right… Read More »

## Print level order traversal line by line | Set 1

Given a binary tree, print level order traversal in a way that nodes of all levels are printed in separate lines. For example consider the… Read More »

## Check if two nodes are cousins in a Binary Tree

Given the binary Tree and the two nodes say ‘a’ and ‘b’, determine whether the two nodes are cousins of each other or not. Two… Read More »

## Check if a binary tree is subtree of another binary tree | Set 2

Given two binary trees, check if the first tree is subtree of the second one. A subtree of a tree T is a tree S… Read More »

## Inorder predecessor and successor for a given key in BST

I recently encountered with a question in an interview at e-commerce company. The interviewer asked the following question: There is BST given with root node… Read More »

## Find the maximum path sum between two leaves of a binary tree

Given a binary tree in which each node element contains a number. Find the maximum possible sum from one leaf node to another. The maximum… Read More »

Inorder traversal of a Binary tree can either be done using recursion or with the use of a auxiliary stack. The idea of threaded binary… Read More »

## Reverse alternate levels of a perfect binary tree

Given a Perfect Binary Tree, reverse the alternate level nodes of the binary tree. Given tree: a / \ b c / \ / \… Read More »

## Amazon Interview | Set 87 (For SDE)

I recently cleared the Amazon SDE position. Through out my prepration GeeksforGeeks played great role, this is the only site which i referred/followed more than… Read More »

## Print a Binary Tree in Vertical Order | Set 2 (Map based Method)

Given a binary tree, print it vertically. The following example illustrates vertical order traversal. 1 / \ 2 3 / \ / \ 4 5… Read More »

## Print Right View of a Binary Tree

Given a Binary Tree, print Right view of it. Right view of a Binary Tree is set of nodes visible when tree is visited from… Read More »

## Construct a tree from Inorder and Level order traversals | Set 1

Given inorder and level-order traversals of a Binary Tree, construct the Binary Tree. Following is an example to illustrate the problem. Input: Two arrays that… Read More »

## Print all nodes at distance k from a given node

Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at distance k… Read More »