Construction of a binary tree , Data Structure & Algorithms

Q. Construct a binary tree whose nodes in inorder and preorder are written as follows:

Inorder : 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50

Preorder: 20, 15, 10, 18, 17, 30, 25, 40, 35, 38, 50                        

 

Ans:

Construction of a Binary tree whose nodes in inorder and preorder are written as follows:-

Inorder:- 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50

 

Preorder:- 20, 15, 10, 18, 17, 30, 25, 40, 35, 38, 50

2477_Preorder.png

Posted Date: 7/10/2012 6:27:39 AM | Location : United States







Related Discussions:- Construction of a binary tree , Assignment Help, Ask Question on Construction of a binary tree , Get Answer, Expert's Help, Construction of a binary tree Discussions

Write discussion on Construction of a binary tree
Your posts are moderated
Related Questions

Merge sort is also one of the 'divide & conquer' classes of algorithms. The fundamental idea in it is to split the list in a number of sublists, sort each of these sublists & merge

Krushkal's algorithm uses the concept of forest of trees. At first the forest contains n single node trees (and no edges). At each of the step, we add on one (the cheapest one) edg

Q. Write  down the  algorithm  to  insert  an  element  to  a  max-heap  which  is  represented sequentially.           Ans: The algorithm to insert an element "newkey" to

In the last section, we discussed regarding shortest path algorithm that starts with a single source and determines shortest path to all vertices in the graph. In this section, we

Difference between array and abstract data types Arrays aren't abstract data types since their arrangement in the physical memory of a computer is an essential feature of their

the deference between insertion,selection and bubble sort

Regis lives in Brazil and frequently travels to USA, Japan and Europe. He wants to be able to convert Brazilian Reais into US dollars, European euros and Japanese yen. Conversion f

It offers an effective way to organize data while there is a requirement to access individual records directly. To access a record directly (or random access) a relationship is

RENDERING, SHADING AND COLOURING By introducing hidden line removal we have already taken one step away from wire-frame drawings towards being able to realistically model and d