Purchase Solution

Binary tree: preorder, postorder and inorder scan

Not what you're looking for?

Ask Custom Question

(a). Draw the binary tree that the following allocations create.

tnode< int > *root, *a, *c,*d, *e;

e = new tnode< int > (50);
d = new tnode< int > (20, NULL, e);
c = new tnode< int > (30);
b = new tnode< int > (45, c, NULL);
a = new tnode< int > (15, b, d);
root = new tnode< int > (10, NULL, a);

(b). List the nodes in the order of their visit for an NLR (preorder) scan.
(c). List the nodes in the order of their visit for an RLN (postorder) scan.
(d). List the nodes in the order of their visit for an LNR (inorder) scan.

Purchase this Solution

Solution Summary

Binary tree is drawn in ASCII mode, and is available in the text response to the question.

Solution Preview

a. Assuming that tnode call takes arguments like "tnode(value, left subtree, right subtree), given sequence will result in following tree.

...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.