Name
BAN USER
Questions (1)
Comments (6)
Reputation 10
- 0of 0 votes
AnswersIs this possible?
- Name in India for Ad Center
A BST is given. Without using any extra memory AND WITHOUT USING recursion.
1. Convert the BST into Sorted single Linked List.
2. Convert the Sorted Linked List in (1) to exactly identical original BST.
Suppose tree is:
10
/ \
1 N
/ \
N 5
/ \
2 N
/ \
N 4| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
Please see this example. Morris Traversal doesn't look to work for this ques.
BST -> Sorted Single Linked List -> Back to Identical Original BST
5
3 7
Linked List
3 -> 5 (5 is right child of 3)
5 -> 7 (7 is right child of 5)
7 -> N (N means NULL)
BST from above LL is not same as original
3
5
7
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Anyone please share the code iff soln is feasible, without using extra memory!
- Name September 22, 2012