Friday, May 14, 2010

CS301 – Data Structures Assignment # 3 Solution May 14, 2010

Assignment No # 3                 Mark: 20

Your assignment must be uploaded/submitted at or before May 17, 2010
 
 
Question
Consider a binary search tree (BST) that is initially empty. Draw the tree that will result if the following numbers are inserted in the same order given below:            5 Marks
13, 3,1,2,4,12,10,5,8,7,6,9,11,14,15,18
 
After making a BST perform the following operations on it.

a)      Pre order Traversal                       5 Marks
b)      Inorder Traversal                          5 Marks
c)      Postorder  Traversal                      5 Marks






Solution



Binary Search Tree (BST) drawn with the following numbers when inserted in the same order as given 13,3,1,2,4,12,10,5,8,7,6,9,11,14,15,18



















































a. Pre order Traversal

13,3,1,4,2,12,10,5,11,8,7,9,6,14,15,18


b. In Order Traversal

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,18


c. Post Order Traversal

2,1,6,7,8,9,5,10,11,12,4,3,18,15,14,13
Vugurus. Powered by Blogger.

Popular Posts

Blog Archive

Labels

Imp Links

Followers

Total Pageviews

Subscribe for email

Blog Archive

Labels

Search

Loading...

About Me