GeeksforGeeks

A computer science portal for geeks

GeeksQuiz

Login

Given a Perfect Binary Tree like below: (click on image to get a clear view)

Read More »

Top view of a binary tree is the set of nodes visible when the tree is viewed from the top. Given a binary tree, print the top view of it. The output nodes can be printed in any order.

Read More »

A K-D Tree(also called as K-Dimensional Tree) is a binary search tree where data in each node is a K-Dimensional point in space.

Read More »

We have discussed Threaded Binary Tree. The idea of threaded binary trees is to make inorder traversal faster and do it without stack and without recursion.

Read More »

Given an N-ary tree where every node has at-most N children. How to serialize and deserialze it? Serialization is to store tree in a file so that it can be later restored.

Read More »

Serialization is to store tree in a file so that it can be later restored. The structure of tree must be maintained.

Read More »

Given a binary tree and two level numbers ‘low’ and ‘high’, print nodes from level low to level high.

Read More »

A given array represents a tree in such a way that the array value gives the parent node of that particular index. The value of the root node index would always be -1.

Read More »

Given a very large n-ary tree. Where the root node has some information which it wants to pass to all of its children down to the leaves with the constraint that it can only pass the information to one of its children at a time (take it as one iteration).

Read More »

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 random node of the binary tree and can even point to NULL, clone the given binary tree.

Read More »

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

Read More »

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 consisting of a node in T and all of its descendants in T.

Read More »

I recently encountered with a question in an interview at e-commerce company. The interviewer asked the following question:

Read More »

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

Read More »
Page 1 of 1012345...10...Last »