| Author |
Is it possible to generate Binary Tree from the expression given in Inorder?
|
Rohit Aggarawal
Ranch Hand
Joined: Jun 26, 2009
Posts: 37
|
|
|
As per me, it is not possible. Can any one share thoughts on it?
|
SCJP 6.0
SCBCD for JEE 5
|
 |
Geoff Jefferson
Ranch Hand
Joined: Apr 09, 2009
Posts: 102
|
|
I can't help but wonder if this is a homework problem.
If it is, then I really don't think this forum is the right
place to do your research.
|
 |
Steve Fahlbusch
Ranch Hand
Joined: Sep 18, 2000
Posts: 491
|
|
Well why would it be impossible?
in order is just a traversal pattern for a tree, so doing the opposite, ie: generating a tree from a traversal pattern would not seem un do able
|
 |
Rohit Aggarawal
Ranch Hand
Joined: Jun 26, 2009
Posts: 37
|
|
one Intern guy has recently joined my company in Bangalore and asked me this Question.
As per my understanding, it is not possible to do it.
I just want to validate my understanding.
|
 |
Jim Hoglund
Ranch Hand
Joined: Jan 09, 2008
Posts: 525
|
|
One view of an in-order traversal would be that its output is an ordered list. To find
or place an element in it, you would interrupt the scan when the proper location is
found. With a b-tree however, searches and inserts become a series of left-or-right
decisions where each decision eliminates the need for many compares. So these
ideas of looking at everything in order (traversal), versus finding the right slot
(b-tree search), don't have a lot in common.
Jim ... ...
|
BEE MBA PMP SCJP-6
|
 |
 |
|
|
subject: Is it possible to generate Binary Tree from the expression given in Inorder?
|
|
|