Topic — Add New » Posts Last Poster Freshness
Median of BST 9 7 months

Given a BST (Binary search Tree), how will you find median in that?
Constraints:
-No extra memory.
- Algorithm should be efficient in terms of complexity.

Convert Zig Zag level order Traversal of Tree to Doubly Linked List 14 9 months

Consider a Binary Tree. Binary tree must be converted to a doubly linked list in Zig Zag level order Traversal in constant space i.e in place without creating extra nodes .
Conditions :
1)The right pointer of the node must be the next pointer in the doubly linked list.
2)The left pointer of the node must be the previous pointer in the doubly linked list.
For Example consider the below Binary Tree

                                            1
                 ...
Trees 4 Mani 9 months

Given a binary tree , return the root of the largest BST in it if present else return null.

Trees 6 9 months
Google Interview Question about Trees 3 Anand 10 months

Least common ancestor of a binary tree, BST ? complexity ?

c pointers in BST 3 10 months

Given below is a buggy code for implementing BST(just to add node) but strange fact is that if i exculde given lines(see comments) from the code and include(see comments) one i get it working, although either way i guess it should work , but it doesnt, i cant figure out anything out here, badly stuck :(. Kindly help.

using namespace std;
#include<cstdio>
#include<vector>
#include<iostream>

class node{
public:
node *p;<...

Google Interview Question for Software Engineer/Developer (0 - 2 Years) about Trees 11 wgpshashank 11 months

Given a binary search tree. Write a function which takes any given node
from the binary tree and a number.
Function has to return the next higher number of the given number from
the binary search tree.

Google
Breadth First Search traversal without using a queue 8 11 months

You have binary search tree where as every node contains three links, they are parent,left and right. You have provided the element present in the binary tree,Now, How do you find the next element of level order traversal(Breadth First Search Traversal) without using Queue?
Note: Every node contains link to Parent Node along with left and right link, can we able to make use of this to solve this problem.

interview question about BST 3 1 year
student Interview Question for Other (0 - 2 Years) about Data Structure 2 itspankaj 1 year

Merge two BST into One.
BST t2 is merged into BST t1.

student
Amazon Interview Question for Software Engineer/Developer (Fresher) 3 1 year

Write code to check whether given tree is BST or not. ( initially I gave O(n^2) he said optimize then I gave O(n) and O(n) space then he said we don't have this much space then I was able to do in O(n) and O(1) space).
3. Whether code is thread safe?
4. How to make it thread safe?

i stuck in 2nd & 3rd part ..can any1 help...i dont wnats ans. of 1st part just explain me 2nd &b 3rd part

Amazon
[closed] Adobe Interview Question for Software Engineer/Developer (Fresher) 8 Venki 1 year

find 5th Maximum in BST given bst is of
4
/ \
2 6
/\ / \
1 3 5 7

Adobe
Amazon Interview Question for Software Engineer/Developer about Trees 8 1 year

Given a binary tree, find the largest subtree that's also a BST.

Amazon
A Binary Tree question 2 1 year

Given a Binary Tree Convert it to a BST

[closed] BST questions 2 1 year

1. Can we make a binary search tree if we are given JUST the preorder traversal of the elements ?

2. Can we make a binary search tree if we are given JUST the postorder traversal of the elements ?

[closed] Amazon Interview Question for Software Engineer/Developer about Trees 2 Sandeep 1 year

Given a binary tree. Find the max sub-tree (having max no of nodes) that form BST in this binary tree.

Amazon
Negation of BST 2 2 years

Given a BST and the elements of the tree are negated , rearrange the tree such that final output is also a BST