Skip to content
SmartFigureEduExam kits ₹19

CS25C04 · QP 30037 · Apr/May 2026

CS 25C04 Data Structures and Algorithms question paper, April/May 2026

Question Paper Code : 30037

B.E./B.Tech. DEGREE EXAMINATIONS, APRIL/MAY 2026.

Second Semester

B.E. Electrical and Electronics Engineering

CS 25C04 — DATA STRUCTURES AND ALGORITHMS

(Common to : B.E. Electrical and Electronics Engineering (Training Integrated))

(Regulations 2025)

Time : Three hoursMaximum : 100 marks

Answer ALL questions.

PART A — (10 × 1 + 10 × 3 = 40 marks)

  1. 1.

    __________ is different components of a software system that does not reveal the internal details of their respective implementations.

    1. (A)Abstraction
    2. (B)Encapsulation
    3. (C)Inheritance
    4. (D)Polymorphism

    CO1 · BL1

  2. 2.

    Among the following options, which of the following type of data structure is used in recursion?

    1. (A)Queues
    2. (B)Array
    3. (C)List
    4. (D)Stack

    CO1 · BL2

  3. 3.

    Suppose you want to delete the name that occurs before “Vivek” in an alphabetical listing. Which of the following data structures shall be most efficient for this operation?

    1. (A)Circular linked list
    2. (B)Doubly linked list
    3. (C)Linked list
    4. (D)Dequeue

    CO4 · BL3

  4. 4.

    Which traversal in a binary search tree visits the elements in sorted order?

    1. (A)Pre-order
    2. (B)Post-order
    3. (C)In-order
    4. (D)Level

    CO1 · BL2

  5. 5.

    Heap can be used as __________.

    1. (A)Priority queue
    2. (B)Stack
    3. (C)A decreasing order array
    4. (D)Normal Array

    CO1 · BL2

  6. 6.

    A __________ of a graph G is a subgraph of G that contains all the vertices of the graph G.

    1. (A)Connected subgraph
    2. (B)Directed acyclic graph
    3. (C)Spanning subgraph
    4. (D)Undirected subgraph

    CO1 · BL2

  7. 7.

    Which notation is used to measure the upper bound on the growth rate of an algorithm's time complexity?

    1. (A)Big O notation
    2. (B)Omega notation
    3. (C)Theta notation
    4. (D)Amortized notation

    CO1 · BL2

  8. 8.

    If an algorithm's time complexity is given by O(1), what does it signify?

    1. (A)Polynomial complexity
    2. (B)Constant complexity
    3. (C)Exponential complexity
    4. (D)Linear complexity

    CO1 · BL3

  9. 9.

    The space consumption of sorting algorithms is sometimes an important consideration. In particular, some sorting algorithms require the creation of additional temporary arrays to hold intermediate results. Which statement is correct?

    1. (A)Bubble sort requires no additional arrays, whereas selection sort, insertion sort, Merge sort and Quicksort all require additional arrays
    2. (B)Bubble sort and selection sort require no additional arrays, whereas insertion sort, Merge sort and Quicksort all require additional arrays.
    3. (C)Bubble sort and insertion sort require no additional arrays, whereas selection sort, Merge sort and Quicksort all require additional arrays.
    4. (D)Selection sort, bubble sort, and insertion sort require no additional arrays, whereas Merge sort and Quicksort require additional arrays.

    CO3 · BL3

  10. 10.

    Rehashing is typically triggered when which value exceeds a certain threshold?

    1. (A)Table size
    2. (B)Hash code
    3. (C)Load factor
    4. (D)Number of collisions

    CO3 · BL2

  11. 11.

    Differentiate Shallow and Deep Copying.

    CO1 · BL2

  12. 12.

    What is a namespace? Explain with an example

    CO1 · BL1

  13. 13.

    Define the Stack Abstract Data Type and its fundamental operations.

    CO2 · BL2

  14. 14.

    Give the pseudocode for inorder binary tree traversal.

    CO2 · BL3

  15. 15.

    Explain the data structures that can be used to store and manipulate a graph data.

    CO2 · BL2

  16. 16.

    What do you mean by best and worst-case time complexities of an algorithm? What is the time complexity of the following code: for (i = n/2; i <= n; i++){ for (j = 2; j <= n; j = j *2){ k = k+ n/2 }}

    CO2 · BL4

  17. 17.

    Write a recursive function to compute the factorial of an integer. Analyze the time complexity.

    CO2 · BL3

  18. 18.

    What are key differences between Greedy Algorithms and Dynamic Programming? Explain with an example.

    CO3 · BL2

  19. 19.

    Provide the pseudocode for Binary search algorithm.

    CO3 · BL4

  20. 20.

    What are the different graph traversals? Explain any one with example.

    CO3 · BL2

PART B — (5 × 12 = 60 marks)

  1. 21.
    (a)

    Design an abstract class Vehicle with methods calculate Fuel Efficiency( ) and maxSpeed( ). Derive classes such as Car, Truck, and Motorcycle that implement these methods. Further extend: • ElectricCar from Car • HybridTruck from Truck. Implement a program to input vehicle details and display fuel efficiency and maximum speed. Assume the necessary attributes for each class.

    CO2 · BL5

  2. Or
  3. (b)

    Given a sorted linked list, implement a function to remove duplicate elements such that each element appears only once. Give the time complexity of your algorithm.

    CO2 · BL5

  4. 22.
    (a)

    Construct a Binary Search Tree by inserting the following elements in the given order: 10, 3, 15, 22, 6, 45, 65, 23, 78, 34, 5. Also design an algorithm to construct the Binary Search Tree.

    CO2 · BL4

  5. Or
  6. (b)

    Consider the following AVL tree, Perform the operations insert(4), insert(7) and insert(1) and the necessary rotations to rebalance the AVL-tree. In the resulting tree, perform the operations delete(5) and delete(7) and the necessary rotations to re-balance the AVL-tree. Draw the state of the tree after each operation. [Figure: AVL tree with root 8; 8 has left child 3 and right child 12; 3 has left child 2 and right child 6; 6 has left child 5; 12 has left child 10.]

    CO2 · BL4

  7. 23.
    (a)

    Given a DAG as follows, [Figure: directed acyclic graph on vertices A–H with edges A→B, A→C, A→F, B→E, B→F, C→D, C→F, F→G, G→D, H→E, H→F, H→G.] The indegree of each vertex in the graph to the left is : A : 0, B : 1, C : 1, D : 2, E : 2, F : 4, G : 2 and H : 0.

    • (i)Show the ordering of vertices by topological sort for the given DAG. Assume we start from node A.(4)
    • (ii)Give an implementation for the topological sorting algorithm. Discuss on its performance. What happens to this algorithm if it has cycles?(8)

    CO2 · BL4

  8. Or
  9. (b)

    [Figure: undirected weighted graph on vertices s, t, u, v, w with edges s–u 6, s–t 3, s–v 2, t–u 5, t–w 5, t–v 4, u–v 4, u–w 1, v–w 6.]

    • (i)Draw the minimum spanning tree that would result from running Prim's and Kruskal's algorithm on this graph, starting at vertex s. List the order in which edges are added to the tree.(10)
    • (ii)Compare and contrast their performance(2)

    CO2 · BL4

  10. 24.
    (a)

    A sequence S contains n-1 unique integers in the range [0, n−1]. There is one number from this range that is not in S. Design an O(n) time algorithm for finding that number. Discuss on the time and space complexity of your algorithm.

    CO4 · BL5

  11. Or
  12. (b)

    Design a recursive algorithm for finding the nᵗʰ Fibonacci number using binary recursion. Draw the recursion trace for n equal to 4.

    CO4 · BL5

  13. 25.
    (a)

    Design an algorithm for merge sort. Check the working of the design for the following input, 15, 6, 3, 12, 9, 18, 1, 20.

    CO3 · BL4

  14. Or
  15. (b)

    Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, 59 into a closed hash table of length m = 11 using the primary hashing function h(K) = k mod m. Illustrate the result of inserting these Keys using

    • (i)Linear probing.(5)
    • (ii)Quadratic probing with hᵢ(k) = (h(k) + i + 3i²) mod m.(5)
    • (iii)Give the efficiency of hash tables.(2)

    CO3 · BL4