0% found this document useful (0 votes)
35 views

Data Structures and Algorithms PYQ

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Data Structures and Algorithms PYQ

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Ex/TIU/ESA/CSE/CSE-AI/Sem-O/2023-24

CSE/CSE-AI, 2nd YR. END SEMESTER (AUTUMN) EXAMINATIONS, 2024

Subject Name: Data Structures and Algoritms


Subject Code: TIU-UCS-T201

Full Marks:70 Time Allotted: 3 hours


The figures in the right margin indicate full marks.
Candidates are required to give their answer in their own words as far as applicable.
Unless otherwise specified, the notations / symbols have their usual meanings.
Use of non-programmable calculator is allowed.

Group-A

1. (Answer any ten questions) 2 x 10 = 20

i) Does the array support random access? Explain briefly whether yes or no.
ii) Provide similarity and difference between binary tree and binary search tree.
iii) In brief, define root and leaf of a tree.
iv) The tree traversal of a binary search tree, that provides the output sequence in ascending
order, is called _____________.
v) Given base address of an array B[900 … 1800] as 1156. The word/element size is 4
bytes. Find the address of B[1400] in row major order.
vi) Mention any two ways of node deletion from binary search tree.
vii) A list of elements in which enqueue operation takes place from ___________, and
___________ operation takes place from ___________ is called ___________.
viii) If the clements '22', '11', '55', '33' and '44' are added in a stack, what would be the output
sequence?
ix) In case of linear search, the complexity is ___________. Give an example of non-
linear search.
x) Differentiate between big O and big Theta notations.
xi) Briefly differentiate between a variable and a pointer.
xii) For a Binary Search Tree, calculate the number of nodes at level 4. Consider the starting
level as 0 (zero).

Group- B

(Answer all of the following questions) 5x4 = 20

2. Furnish code snippet along with explanation for identifying an empty Queue. Briefly analyze
two operations for Queue. (3 + 2 marks)

Or

Furnish code snippet along with explanation for identifying an empty Stack. Briefly analyze two
operations for Stack. (3 + 2 marks)

3. Provide algorithm for addition of all the digits of a three digit number. State your understanding
of the algorithm characteristic "finiteness". (3 + 2 marks)
Or
Ex/TIU/ESA/CSE/CSE-AI/Sem-O/2023-24

Provide algorithm for multiplication of all the digits of a three digit number. State your
understanding of the algorithm characteristic "definiteness". (3 + 2 marks)

4. Differentiate between graph and tree. State your understanding of time complexity. Why do we
need to initialize stack top as -1? (2 + 1 + 2 marks)
Or

Differentiate between linear and non-linear data structure. State your understanding of space
complexity. Why do we need modular operation in case of circular queue for insertion and
deletion, explain? (2 + 1 + 2 marks)

5. Give the algorithm for insertion sort and explain it using:


4, 36, 7, 11, 2, 5, 12, 2, 17 values, for ascending order.
Mention the advantage of representing stack using linked list than array. (4 + 1 marks)
Or
Give the algorithm for selection sort and explain it using: 18, 24, 19, 32, 43, 5, 23, 2, 11 values,
for descending order.
Mention your understanding of internal nodes of any tree. (4 + 1 marks)

Group C

(Answer all of the following questions) 10x3 = 30

6.

Mention the data structure used for Depth First Search (DFS). Find out the Depth First Search
traversal pattern starting from vertex 4 (of the above figure). Give the code snippet for deletion
at particular position in case of singly linked list. (1 + 6 + 3 marks)
Or
Ex/TIU/ESA/CSE/CSE-AI/Sem-O/2023-24

Mention the data structure, used for Breadth First Search (BFS). Find out the Breadth First
Search traversal pattern starting from vertex 4 (of the above figure). Give the code snippet for
insertion of a node at any particular position in the doubly linked list. (1 + 6 + 3 marks)

7.

For the above figure, find out the followings: (2 + 2 + 2 + 4 marks)

i. Pre-Order traversal pattern iii. Post-Order traversal pattern

ii. In-Order traversal pattern iv. Breadth First Search pattern for
the starting vertex = 41

Or
Elaborate the followings: (2 + 2 + 2 + 4 marks)

i. Balance factor of AVL tree, its need

ii. LR imbalance conversion with suitable example

iii. RL imbalance conversion with suitable example

iv. Create a Binary Search Tree (BST) using: 19, 23, 20, 8, 40, 27, 65, 29, 11, 3.

8. Convert to prefix expression: w + x – y * a * c – d / f / g / h / q - e, using stack.


Create AVL tree using: 17, 23, 34, 48, 43, 11, 6, 31, 10, 19.
State your understanding of adjacency list. (4 + 4 + 2 marks)

Or

Convert to postfix expression: d * e – c ^ f + g + h / i / j / k – q * s, using stack.


Give your idea of implementing two stacks using only one array.
How do you represent a polynomial using linked list? Give suitable example.
State your understanding of doubly linked list along with its advantage over singly linked list.
(4 + 2 + 2 + 2 marks)

You might also like