Model QP Datastructures
Model QP Datastructures
DATA STRUCTURES
Class : II B.Sc CS/ II BCA/ II B.Sc IT /I B.Sc Al&Ml Marks: 75
Code : 23CSU09/23CAU09/23ITU09/24AMU03 Time: 3 Hrs
SECTION-A
I. ANSWER THE FOLLOWING (10*1=10)
2. Which data structure would be most appropriate for checking if parentheses in an expression are
balanced? (K2) (CO2)
a) Queue b) Stack c) Array d) Tree
3. Which traversal method visits the root node first, then the left subtree, and finally the right subtree?
a) In-order b) Pre-order c) Post-order d) Level-order (K1)(CO1)
4. What is the time complexity for inserting a node at the beginning of a singly linked list?
a) O(1) b) O(n) c) O(log n) d) O(n²) (K2) (CO2)
5. The shortest path between two vertices in a graph is calculated using: (K1)(CO1)
a) Depth-First Search b) Kruskal's Algorithm c) Dijkstra's Algorithm d) Merge Sort
6. Which of the following is the most memory-efficient way to represent a sparse graph? (K2) (CO2)
8. Which of the following sorting algorithms can be used efficiently to sort strings or records with
multiple keys, such as names or dates? (K2) (CO2)
10. Which of the following overflow handling methods for hash tables tries the next available bucket
when a collision occurs? (K2) (CO2)
a) Chaining b) Quadratic probing c) Linear probing d) Double hashing
SECTION-B
II. ANSWER THE FOLLOWING (5*5=25)
11.a)| Explain the concept of arrays and their representation in memory. (K2)(CO2) (Or)
b) Define sparse matrices and explain their representation. Provide an example to illustrate your
explanation. (K2)(CO2)
12.a) Describe how polynomial addition can be implemented using linked lists. Explain the structure
of a node in this context and provide a brief example of adding two polynomials represented as linked
lists. (K2)(CO2) (Or)
b) Define basic terminology related to trees. What are the main characteristics of a binary tree? Provide
an example of a binary tree and explain its components. (K2) (CO2)
13.a) Define a graph and explain its basic terminology with examples (K3)(CO3) (Or)
b) Write Kruskal algorithm to construct minimum cost spanning tree. Evaluate the various stages with
a graph. (K3)(CO3)
14.a) Explain the Insertion Sort algorithm with an example. What is its time complexity? (K3)(CO3)
(Or) b) Perform Heap Sort on the array [12, 3, 9, 14, 10, 18, 8, 23]. Show the process of building the
heap and sorting the array step-by-step. (K3)(CO3)
15. a) Describe methods of handling overflow (or collisions) in Hash Tables. Compare open addressing
and chaining as strategies for collision resolution. (K4) (CO4) (Or)
b) Given a set of symbols with frequencies [A:5, B:9, C:12, D:13, E:16, F:45], use the Huffman
algorithm to construct the Huffman Tree and calculate the weighted external path length. (K4)(CO4)
SECTION-C
III. ANSWER THE FOLLOWING (5*8=40)
16. a) Discuss the fundamentals of stacks and queues. How do they differ in terms of operations and
use cases? Provide an example of each. (K3)(CO3) (Or)
b) Create an algorithm that converts an infix expression postfix and then Convert the following
infix expression to prefix and postfix: (A + B )/ (C – D) – (E * F). (K3) (CO3)
17. a) Write an algorithm for insertion and deletion in a singly linked list and a doubly linked list.
Provide an example to demonstrate the process. (K4)(CO4) (Or)
b) Describe the different methods for traversing a binary tree. Provide algorithms for each method
and illustrate their execution with a given binary tree. (K4)(CO4)
18. a) Explain Depth-First Search (DFS) and Breadth-First Search algorithms. Provide an example and
mention their applications.(K4)(CO4) (Or)
b) Explain the algorithm for finding the shortest paths between all pairs of vertices in a weighted graph.
Provide an algorithm, and illustrate it with an example. (K4) (CO4)
19.a) Explain the quick sort algorithm. Sort the array [10, 80, 30, 90, 40, 50, 70] using Quick Sort.
Describe the key steps involved in the sorting process and how the algorithm achieves sorting.
(K5)(CO5) (Or)
b) Write the Merge Sort algorithm and explain how it divides and conquers to sort an array. What
is the time complexity of Merge Sort? (K5) (CO5)
20. a) Explain different types of Hashing Functions used in Hash Tables. Provide examples of common
hashing functions. (K5)(CO5) (Or)
b) Discuss how Dynamic Tree Tables are implemented using AVL Trees. Provide a detailed
explanation of how insertion is performed and how the tree maintains balance as the table grows.
(K5)(CO5)