How can we insert the following numbrs 7,5,1,8,3,2 in a binary tree so that inorder and preorder traversal is same

This question is related to BirlaSoft Interview

Showing Answers 1 - 6 of 6 Answers

vikrant

  • Dec 13th, 2005
 

I think answer to it put every node on rightside 7-->5-->1-->8....then its preoder and inoder will be same

  Was this answer useful?  Yes

krishna prasad

  • Feb 21st, 2006
 

first we place the numbers from starting. if the next no is larger than the before no,then we place the no inright side of the before no. if it is less place left side of the no. inthis way we place the no's.

  Was this answer useful?  Yes

coder

  • Jun 10th, 2006
 

inorder = Me Left Rightpreorder = Left Me Rightif inorder == preorderthen Left = Empty Spaceso , we have to insert in order of1,2,3,5,7,8

  Was this answer useful?  Yes

mukesh_patel_IEC

  • Feb 13th, 2007
 

arrange 7-5-1---- in the rightmost of tree so that the preorder and inordered traversal is same..

  Was this answer useful?  Yes

prakasah

  • May 29th, 2007
 

inorder:-758312  preorder:-853721 or depends upon how u make the tree
inorder:-751328  preorder:-12578

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions