Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views2 pages

DS Assignment 3

The document outlines an assignment for a Data Structures course, focusing on binary trees, expression trees, and various algorithms related to tree traversal and manipulation. It includes tasks such as constructing trees from traversals, writing algorithms for in-order traversal, and exploring concepts like threaded binary trees and AVL trees. Additionally, it covers B-trees and their applications, along with comparisons between B+ trees and B-trees.

Uploaded by

Vipin chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

DS Assignment 3

The document outlines an assignment for a Data Structures course, focusing on binary trees, expression trees, and various algorithms related to tree traversal and manipulation. It includes tasks such as constructing trees from traversals, writing algorithms for in-order traversal, and exploring concepts like threaded binary trees and AVL trees. Additionally, it covers B-trees and their applications, along with comparisons between B+ trees and B-trees.

Uploaded by

Vipin chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Data Structure (CS-251)

Assignment III
2023-24

1. Construct binary tree from the given traversals:


i) In-order: BDAEFC Post-order: DBFECA
ii) Pre-order: / + * 1 $ 2 3 4 5 In-order: 1 + 2 * 3 $ 4 – 5
iii) Pre-order: A B D G C E H I F In-order: D G B A H E I C F

2. Construct expression trees for the following expressions:


A/B+C*D+E ((6+(3-2)*5)^2+3)

3. Write an algorithm for non-recursive in-order traversal of a binary tree.

4. For the expression tree given below, do the following:


(a) Extract the in-order expression it represents
(b) Find the corresponding pre-order and post-order expressions
(c) Evaluate the in-order expression, given a = 30, b = 10, c = 2, d = 30, e = 10

5. Construct a binary search tree for the given inputs:


i) 22, 14, 18, 50, 9, 15, 7, 6, 12, 32, 25
ii) 14, 5, 6, 2, 18, 20, 16, -1, 21
6. What is a threaded binary trees? Explain the advantages of using a threaded binary tree. Also write
algorithm/function for in-order traversal of threaded binary tree.
7. Write an algorithm to delete a node with given info in a right-in threaded binary search tree. Write
segments for deletion of leaf node, node with 1 direct descendant and node with two direct descendants
separately.
8. Transform the following binary tree to a right in-threaded binary tree.
9. Write the algorithm for deletion of an element in binary search tree where node has two children.
10. What is a height-balanced Tree? Why is height balancing of tree required? Obtain an AVL tree by
inserting one integer at a time in the following sequence. 150, 155, 160, 115, 110, 140, 120, 145, 130,
147, 170, 180. Show all the steps.
11. What is the maximum height of any AVL-tree with 7-nodes? Assume that the height of a tree with
single node is 0.
12. What are the applications of B-tree? Draw a B-tree of order 4 by inserting the following keys in the
given order: Z, U, A, I, W, L, P, X, C, J, D, M, T, B, Q, E, H, S, K, N, R, G, Y, F, O, V.
13. Compare and contrast the difference between B+ tree index files and B-tree index files with an
example.
14. A B-tree of order 4 is built from scratch by 10 successive insertions. What are the maximum number
of nodes splitting operations that may take place?
15. Consider a B+ tree in which the maximum number of keys in a node is 5. what is the minimum
number of keys in any non-root node?

You might also like