Data Structures and Algorithms PYQ
Data Structures and Algorithms PYQ
Group-A
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
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)
Group C
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.
ii. In-Order traversal pattern iv. Breadth First Search pattern for
the starting vertex = 41
Or
Elaborate the followings: (2 + 2 + 2 + 4 marks)
iv. Create a Binary Search Tree (BST) using: 19, 23, 20, 8, 40, 27, 65, 29, 11, 3.
Or