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
sdsd.

Tree is dynamic data structures. Trees can expand & contract as the program executes and are implemented via pointers. A tree deallocates memory whereas an element is deleted.

Evaluate the frequency counts for all statements in the following given program segment. for (i=1; i ≤ n; i ++) for (j = 1; j ≤ i; j++) for (k =1; k ≤ j; k++) y ++;

In the amortized analysis, the time needed to perform a set of operations is the average of all operations performed. Amortized analysis considers as a long sequence of operations

Write an assembly program to separate the number of positive numbers and negative numbers from a given series of signed numbers.

State about the pre- and post conditions Programmers can easily document other pre- and post conditions and class invariants, though, and insert code to check most value preco

Painter's Algorithm As the name suggests, the algorithm follows the standard practice of a painter, who  would paint the background (such as a backdrop) first, then the major d

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

A telephone directory having n = 10 records and Name field as key. Let us assume that the names are stored in array 'm' i.e. m(0) to m(9) and the search has to be made for name "X"

Explain in detail the algorithmic implementation of multiple stacks.