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

Final Exam Question 171 CSI217

The document summarizes a final exam for a data structures course. It includes 6 questions with multiple parts each, covering topics like linked lists, stacks, queues, trees, and graphs. Students must answer 4 out of the 6 questions. The exam tests algorithms and implementations for common data structures.

Uploaded by

Parvej ahmed
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)
125 views2 pages

Final Exam Question 171 CSI217

The document summarizes a final exam for a data structures course. It includes 6 questions with multiple parts each, covering topics like linked lists, stacks, queues, trees, and graphs. Students must answer 4 out of the 6 questions. The exam tests algorithms and implementations for common data structures.

Uploaded by

Parvej ahmed
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 & Engineering (CSE)


Final Exam Year: 2017 Trimester: Spring
Course: CSI 217 Data Structures, Marks: 40, Time: 2 hours
There are SIX questions. Answer any FOUR. Figures in the right-hand margin indicate full marks.

1. a. What are the merits of linear circular linked list over linear linked list? [2]
b. Develop an algorithm to delete middle element from a doubly linked list. [2]
c. Design two algorithms to insert and delete first element to/from a linear circular linked
list. [4]
d. Write an algorithm to display elements of doubly linked list in reverse order. [2]

2. a. Define STACK and QUEUE. Distinguish between them. [2]


b. Design an algorithm using STACK to check whether the given string “UIU’’ is
palindrome or not. [3]
c. What are the applications of a QUEUE in real life? Suppose, you have to implement a
QUEUE data structure using only one STACK. Can you give an idea how can we do
that? [2]
d. Write an algorithm to display all the integer elements stored in a QUEUE implemented
by a linear linked list. [3]

3. a. Convert the following infix expression into postfix using STACK and evaluate the
postfix expression for the given values. [5]
Infix expression: a * a - (b + c / d) + e * f
Given values: a=2, b=3, c=4, d=2, e=3 and f=2
b. Given, double A[100], which represents a one dimensional array of type double. If
loc(A[0])=6FADE then, find loc(A[60]). [1]
c. Design a recursive algorithm for TOWER OF HANOI using one intermediate
pillar/peg and show simulation for n = 3, where n is the number of disks. [2]
d. Design an iterative algorithm for TOWER OF HONOI assuming two intermediate
pillars/pegs. [2]

4. a. What are the applications of a graph in real life? [1]


b. Show the mechanism of topological ordering algorithm for the following directed
acyclic graph. [3]
c. Write an algorithm for Breadth First Search (BFS) in a graph. [2]
d. Write algorithm to perform the following operations: [3]
i. To take input for a simple graph
ii. To find adjacent vertices of a given vertex in the graph
iii. To determine the highest degree among vertices.
5. a. Write an algorithm for the POST ORDER traversal technique in a binary tree. [2]
b. Construct binary search tree from the following given tree traversal sequences. [3]
Preorder: ABDEFCGH
Inorder: DBFEACHG
c. Define complete binary tree. Find the total number of nodes in a complete TERNARY
tree if the height of the tree is h. [3]
d. For question no. 5 (b) above, find external and internal path length. [2]

6. a. Suppose you are waiting for having a train ticket in a railway station. The station
manager tells you to maintain a line for ticket. Answer the following questions based on
this scenario. [3]
i. Which data structure are appropriate for maintaing a line?
ii. Implement a line using your data structure.
iii. How will you track the start and end of a line?

b. Which data structures are more appropriate for the following cases and why? [3]
i. For implementing the binary search tree.
ii. For reducing the memory wastage in a sparse matrix.
Iii. For storing student information like name, id, birthday, marks.
c. Write an algorithm to construct binary tree in memory. [2]
d. Design an algorithm to evaluate the following Binary Expression Tree (BET). [2]

Explanation: For the above BET, calculation will be in the following order:
= (12-3) * 2
=9*2
= 18, which is the final answer.

You might also like