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

Summer 22

The document is a final exam for a data structures and algorithms course. It contains 4 questions assessing different data structures: 1) Binary trees, including drawing trees from preorder/inorder traversals, level order traversal algorithm, and tree properties. 2) Queues and priority queues, including operations and representations. 3) Graphs, including adjacency matrix/list, topological sorting of DAGs, and graph properties. 4) Additional data structures including binary search trees, depth-first search on graphs, and appropriate structures for given scenarios.

Uploaded by

Partho Protim
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)
39 views2 pages

Summer 22

The document is a final exam for a data structures and algorithms course. It contains 4 questions assessing different data structures: 1) Binary trees, including drawing trees from preorder/inorder traversals, level order traversal algorithm, and tree properties. 2) Queues and priority queues, including operations and representations. 3) Graphs, including adjacency matrix/list, topological sorting of DAGs, and graph properties. 4) Additional data structures including binary search trees, depth-first search on graphs, and appropriate structures for given scenarios.

Uploaded by

Partho Protim
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

United International University (UIU)

Dept. of Computer Science and Engineering (CSE)


Final Examination Trimester: Summer 2022
Course: CSE 2215 Data Structure and Algorithms-I
Total Marks: 40, Time: 2 hours

(Any examinee found adopting unfair means will be expelled from the trimester /
program as per UIU disciplinary rules)

There are FOUR questions. Answer all of them. Figures in the right-hand margin
indicate full marks.

1. a) Draw a binary tree using the data given below, where x, y, z, p, r, t, u and v are nodes of the [1]
tree.
y p z x r t u v
Here, x=last two digits of your student id+5, y=x+3, z=x+y, p=y+z, r=x+2, t=p+r, u=600, v=700

b) Traverse the binary tree of Ques. 1(a) using the preorder, inorder, and postorder techniques. [4]
Level each of the nodes of the tree. Also find the height of the tree using level.

c) Draw a binary tree from the following Preorder and Inorder sequences [2]
Preorder: x y p r z t v u
Inorder: p y r x t v z u
Here, x=last two digits of your student id+5, y=x+3, z=x+y, p=y+z, r=x+2, t=p+r, u=600, v=700

d)Write an algorithm for the level order. Show the simulation for the tree in Ques. 1(a). [3]

2. a) Show the status of a QUEUE and a Priority QUEUE (Data in Ascending Order) for the [3]
following operations, where both QUEUEs are implemented by an array of size, m=3. Here,
Enqueue and Dequeue mean insert and delete respectively, and x=last two digits of your student
id+5, y=x+3, z=x+y and p=y+z.
Enqueue(z), Enqueue(p), Dequeue(), Enqueue(y), Enqueue(z), Dequeue()

b) Draw a complete binary tree and then build the min-heap tree from the following [5]
data, where x= last two digits of your student id+150, y=x+130, and z=x+y. Finally, sort the data
in descending order using the heapsort algorithm.
10 x 20 z y 8

c) Two disjoint sets {y, p, z, x} and {r, t} are given, where maximum one of a set is the [2]
representative of that set. Determine UNION(Find(x), Find(t)). How can you check x and y are
in the same set using Find operation? Here, x=last two digits of your student id+9, y=x+3,
z=x+y, p=y+z, r=x+2, t=700.

3. a) Draw a directed acyclic graph using the vertices y, p, z, x, r and u, where x=last two digits of [1]
your student id+5, y=x+3, z=x+y, p=y+z, r=x+2, u=p+r

b) Construct an Adjacency Marix and an Adjacency List for the graph in Ques. 3(a). [3]

c) Write an algorithm for Topological Sorting. Show the simulation of your algorithm using the [4]
graph in Ques. 3(a).

d) Draw a sparse and a dense graph using the vertices y, p, z, x, and r, where x=last two digits of [2]
your student id+5, y=x+3, z=x+y, p=y+z, r=x+2

1
4. a) Draw an undirected graph using the vertices y, p, z, x and r, where x=last two digits of your [2]
student id+5, y=x+3, z=x+y, p=y+z, r=x+2. Also find the Depth First Search (DFS) sequence
from the graph considering x is the starting vertex.

b) Construct a binary search tree (BST) using the nodes y, p, z, x, r and t, where x=last two [3]
digits of your student id+5, y=x+3, z=x+y, p=y+z, r=x+2, t=900. Show the insertion and
deletion of p+r and z, respectively in/from the BST.

c) Write an algorithm to display all the elements stored in a QUEUE implemented by an array. [2]

d) Which Data Structures are appropriate to implement the following and why?
[3]
i) Different areas of Dhaka City with distances
ii) Line in front of a Lift
iii) Binary Tree Construction

You might also like