0% found this document useful (0 votes)
11 views4 pages

Set Wise Pre-T1

The document outlines an assignment for Data Structures and Algorithms with specific instructions for students to complete tasks based on their roll numbers. Each roll number group has distinct questions involving binary search trees, max-heaps, AVL trees, and tree traversals, with a submission deadline of April 27, 2025. Students are required to work on the problems related to their assigned roll numbers only.

Uploaded by

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

Set Wise Pre-T1

The document outlines an assignment for Data Structures and Algorithms with specific instructions for students to complete tasks based on their roll numbers. Each roll number group has distinct questions involving binary search trees, max-heaps, AVL trees, and tree traversals, with a submission deadline of April 27, 2025. Students are required to work on the problems related to their assigned roll numbers only.

Uploaded by

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

Data Structures and Algorithms

Assignment
Pre-T1
Instructions:
1. Write the Assignment Only on A4 Sheets
2. Students should attempt the questions only under their corresponding rollno
specified below.
3. Deadline to submit the Assignment- 27-04-2025

Stu Roll No: 241FM04001,241FM04011


1. Create a binary search tree for the following sequence of alphabets: D, B, A, G, E, H,
C, F, J, K, L, N, O, M, N. Calculate the number of comparisons required to search for
an element P in the tree and write the time complexity in doing that.
2. Create a max-heap for the following elements using the UP-HEAPIFY method: 3, 9, 2,
1, 4, 5, 6, 10, 12, 14, 7. Extract the third maximum element from the priority queue
and apply the proper heapify process wherever required. Write an algorithm for the
max-heap.
3. Draw the AVL tree that results from inserting the keys 14, 11, 22, 13, 29, 15, 7, 35 in
that order into an initially empty AVL tree. Draw intermediate trees and also Give a
Post-order traversal of your final tree.

Stu Roll No: 241FM04002,241FM04013


1. Build a max-heap using the following elements. Extract the third max element from
the max-heap. Elements: 5, 12, 8, 3, 10, 7, 6, 15, 9, 11, 4.
2. Find the Preorder traversal if the following are given for a binary tree T:
Inorder Traversal of T: 4 2 1 7 5 8 3 6
Postorder Traversal of T: 4 2 7 8 5 6 3 1
3. Draw the AVL tree that results from inserting the keys 10, 5, 20, 15, 30, 25, 40, 35 in
that order into an initially empty AVL tree. Draw intermediate trees and also Give a
Pre-order traversal of your final tree.

Stu Roll No: 241FM04003,241FM04015


1. Create a binary search tree for the following sequence of alphabets: M, F, R, B, H, T,
A, K, P, Q, S, U, V, N, Q. Calculate the number of comparisons required to search for
an element W in the tree and write the time complexity in doing that.
2. Create a max-heap for the following elements using the UP-HEAPIFY method: 20, 15,
8, 10, 5, 18, 3, 30, 12, 25. Extract the third maximum element from the priority
queue and apply the proper heapify process wherever required. Write an algorithm
for the max-heap.
3. Find the Preorder traversal if the following are given for a binary tree T:
Inorder Traversal: MJNACZLBT
Postorder Traversal: MNAJZTLBC

Stu Roll No: 241FM04004,241FM04016


1. Create a binary search tree for the following sequence of alphabets: F, C, M, A, D, P,
B, K, N, O, Q, S, R, E, R. Calculate the number of comparisons required to search for
an element T in the tree and write the time complexity in doing that.
2. Explain What is a tree. What are different types of tree data structures available?
Give example for each.
3. Draw the AVL tree that results from inserting the keys 45, 40, 50, 35, 42, 60, 38, 39 in
that order into an initially empty AVL tree. Draw intermediate trees and also give a
Post-order traversal of your final tree.

Stu Roll No: 241FM04005,241FM04017


1. Create a binary search tree for the following sequence of alphabets: H, D, N, A, F, Q,
B, J, O, R, S, T, M, R. Calculate the number of comparisons required to search for an
element M in the tree and write the time complexity in doing that.
2. Create a min-heap for the following elements using the UP-HEAPIFY method: 21, 10,
19, 14, 9, 7, 13, 23, 17, 12. Extract the second maximum element from the priority
queue and apply the proper heapify process wherever required. Write an algorithm
for the max-heap.
3. Find the Preorder traversal if the following are given for a binary tree T:
Inorder Traversal of T: ZLMNYACF
Postorder Traversal of T: ZLYNMFCA

Stu Roll No: 241FM04006,241FM04018


1. Create a min-heap for the following elements using the UP-HEAPIFY method: 20, 15,
8, 10, 5, 18, 3, 30, 12, 25. Extract the third maximum element from the priority
queue and apply the proper heapify process wherever required. Write an algorithm
for the max-heap.
2. Find the post order traversal if the following are given for a binary tree T:
In order Traversal of T: 4 2 5 1 6 3 7
Preorder Traversal of T: 1 2 4 5 3 6 7
3. Draw the AVL tree that results from inserting the keys 25, 11, 30, 5, 15, 72, 40, 12 in
that order into an initially empty AVL tree. Draw intermediate trees and also give a
post-order traversal of your final tree.
Stu Roll No: 241FM04007,241FM04019
1. Write the step-by-step procedure for converting general tree to binary tree. Convert
the given general tree into binary tree.

2. Create a binary search tree for the following sequence of elements:


83,54,76,32,11,44,28,67,39,18,90,56. Calculate the number of comparisons required
to search for an element 18 in the tree.
3. Draw the AVL tree that results from inserting the keys 17, 42, 89, 5, 63, 31, 76, 24, 98,
53, 12, 6 in that order into an initially empty AVL tree. Draw intermediate trees and
also give a in-order traversal of your final tree.

Stu Roll No: 241FM04008,241FM04020


1. Write the step-by-step procedure for converting general tree to binary tree. Convert
the following general tree into binary tree.

2. Find the Preorder traversal if the following are given for a binary tree T:
Inorder Traversal of T: DBAGEHCF
Postorder Traversal of T: DBGHEFCA
3. Create a Binary Search Tree for the following sequence of elements K, M, L, A, D, B, F,
E, G, H, J, I, N, O, P. Search for element Q. Calculate the total number of comparisons
made for searching the element Q.

Stu Roll No: 241FM04009,241FM04021


1. Draw the AVL tree that results from inserting the keys: 25, 10, 30, 5, 15, 27, 40, 12
into an initially empty AVL tree. Draw intermediate trees and also give a post-order
traversal of your final tree.
2. Sort the following numbers in descending order using Heap Sort: 3, 9, 2, 1, 4, 5, 6, 10,
12, 14, 7. Write an algorithm for sorting the above numbers in descending order
using Heap sort.
3. Create a binary search tree for the following sequence of elements:
38,45,67,83,12,34,22,56,99,18,108,30. Calculate the number of comparisons
required to search for an element 22 in the tree.

Stu Roll No: 241FM04010,241FM04024


1. Create a max-heap for the following elements using the UP-HEAPIFY method: 17, 8,
10, 5, 4, 6, 3, 20, 13, 12. Extract the third maximum element from the priority queue
and apply the proper heapify process wherever required. Write an algorithm for the
max-heap.
2. What is a binary search tree. Write an algorithm for deleting an element from the
binary search tree.
3. Draw the AVL tree that results from inserting the keys 33, 20, 40, 18, 22, 36, 50, 19 in
that order into an initially empty AVL tree. Draw intermediate trees and also give a
post-order traversal of your final tree.

You might also like