Bst created in pre- order, inorder and post order, Data Structure & Algorithms

Assignment Help:

Q. Make a BST for the given sequence of numbers.

45,32,90,34,68,72,15,24,30,66,11,50,10 Traverse the BST formed in  Pre- order, Inorder and Postorder.                                                                                                             

Ans:

The property which makes a binary tree into a binary search tree is that for each and every node, X, in the tree, values of all the keys in the left subtree are smaller than the key value in X, and values of all the keys in the right subtree are greater than the key value in X.

The Binary Search Tree for given data 45, 32, 90, 34, 68, 72, 15, 24, 30, 66, 11,

50, 10 is as follows:

 

1714_BST.png

The traversals for the tree shown above is as follows: - Pre-order traversal is- 45 , 32, 15, 11, 10, 24, 30, 34, 90, 68, 66, 50, 72

Inorder traversal given as follows:-

10, 11, 15, 24, 30, 32, 34, 45, 50, 66, 68, 72, 90

Postorder traversal is given as follows:-

10, 11, 30, 24, 15, 34, 32, 50, 66, 72, 68, 90, 45


Related Discussions:- Bst created in pre- order, inorder and post order

Searching techniques, Searching is the procedure of looking for something. ...

Searching is the procedure of looking for something. Searching a list containing 100000 elements is not the similar as searching a list containing 10 elements. We discussed two sea

Explain first - fit method, First - Fit Method: -    The free list is trave...

First - Fit Method: -    The free list is traversed sequentially to search the 1st free block whose size is larger than or equal to the amount requested. Once the block is found it

Explain about the structured types - built-in types, Explain about the Stru...

Explain about the Structured types - Built-In Types Values of the carrier set are not atomic, consisting rather than several atomic values arranged in some way. Common illu

Representation of a sparse matrix, Let us assume a sparse matrix from stora...

Let us assume a sparse matrix from storage view point. Assume that the entire sparse matrix is stored. Then, a significant amount of memory that stores the matrix consists of zeroe

What is assertions, What is Assertions Introduction At every point...

What is Assertions Introduction At every point in a program, there are generally constraints on the computational state that should hold for program to be correct. For ins

Sorting, Sort the following array of elements using quick sort: 3, 1, 4, 1,...

Sort the following array of elements using quick sort: 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8.

Queue, what''s queue ?

what''s queue ?

Conversion of general trees into the binary trees, By taking an appropriate...

By taking an appropriate example explain how a general tree can be represented as a Binary Tree.                                                                    C onversio

Algorithm, Ask question #MWhich of the following is not a characteristic of...

Ask question #MWhich of the following is not a characteristic of good algorithm? inimum 100 words accepted#

Circularly linked lists implementation, CIRCULARLY LINKED LISTS IMPLEMENTAT...

CIRCULARLY LINKED LISTS IMPLEMENTATION A linked list wherein the last element points to the first element is called as CIRCULAR linked list. The chains do not specified first o

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd