Unit 1
1. What is a data structure? Why is it important in computer science?
2. Differentiate between data type and data structure with examples.
3. Explain the difference between linear and non-linear data structures
4. What is the difference between static and dynamic data structures?
5. Explain the terms homogeneous and non-homogeneous data structures with examples.
6. What is asymptotic analysis of an algorithm? Why is it needed?
7. Define Big O notation. Give two examples.
8. Explain the difference between sequential and linked organization of data.
9. What is an algorithm? State its characteristics.
10. Differentiate between an algorithm and a program.
11. What are the different approaches to designing an algorithm? Explain:
● Divide and Conquer
● Greedy Method
● Dynamic Programming
● Backtracking
● Brute Force
12. Write a simple algorithm to search for an element in an array.
13. What are the properties of a good algorithm?
Asymptotic Notations
14. What is asymptotic analysis of an algorithm? Why is it needed?
15. Define Big O notation. Give two examples.
16. Define Omega notation. Give two examples.
17. Define Theta notation. Give two examples.
18. Compare Big O, Big Omega, and Big Theta with suitable diagrams.
19. Write the asymptotic complexity for the following operations:
● Traversing an array
● Binary search in a sorted array
● Linear search in an unsorted array
● Insertion in a linked list
Time and Space Complexity
20. What is time complexity? Why is it important in algorithm analysis?
21. What is space complexity? How is it calculated?
22. Differentiate between worst-case, average-case, and best-case time complexity with examples.
23. Find the time complexity of the following:
● Traversing an array
● Bubble sort algorithm
● Binary search algorithm
● Matrix multiplication
24. What is the time and space complexity of recursive algorithms? Explain with factorial example.
25. Why do we prefer asymptotic analysis over actual execution time?
Higher-Order Questions
26. If an algorithm has time complexity O(n²) and another has time complexity O(n log n), which will
run faster for n = 10 and n = 10⁶? Justify with reasoning.
27. Can an algorithm have different best-case and worst-case space complexities? Give an example or
counterexample.
28. Suppose an array contains n elements. What is the maximum number of comparisons needed in
the worst-case linear search? What about the average-case?
29. Consider two algorithms: one with O(n) complexity but large constant factors, and another with
O(n log n) but very small constants. Which would you choose for small n and why?
30. A program runs in O(2ⁿ) time. Is it practical for solving problems when n > 30? Explain your
reasoning with an estimate of operation counts.
Unit 2: Arrays
Part A: Short Answer Questions (Conceptual – 2 to 3 marks each)
1. What is an array? How does it differ from an ordinary variable?
2. What is the difference between row-major and column-major order in arrays?
3. Define a sparse matrix. Why is it needed?
4. Differentiate between a dense matrix and a sparse matrix.
5. Write the formula for calculating the memory address of an element in a 2D array stored
in row-major order.
6. What is the time complexity of array insertion and deletion in the worst case?
7. State one advantage and one disadvantage of using arrays.
Part B: Long Answer Questions (Explanations & Algorithms – 5 to 10 marks each)
13.Write an algorithm to insert an element into a specific position in an array. Analyze its
time complexity.
14.Write an algorithm to delete an element from a given position in an array. Analyze its
time complexity.
15.Explain the concept of sparse matrix representation. Discuss:
● Triplet representation
● Linked list representation
16.Write an algorithm to convert a sparse matrix into triplet form.
17.Write an algorithm to transpose a sparse matrix using triplet representation.
18.Explain the advantages and disadvantages of using arrays vs linked lists for data storage.
19.How can arrays be used to implement stack and queue data structures? Explain with
examples.
20.Explain the process of merging two sorted arrays into one sorted array with algorithm and
complexity analysis.
Part C: Analytical / Problem-Solving Questions (Application & Coding – 10 marks each)
21.Write a C function to insert a new element into a sorted array while maintaining sorted
order.
22.Write a program to delete a specific value (not position) from an array if it exists.
23.Write an algorithm to reverse the elements of an array in-place. Analyze its complexity.
24.Write a program to rotate an array by k positions to the left.
Tricky Questions on Arrays (Unit 2)
25.If an array is stored in row-major order, derive the formula to compute the address of
element A[i][j] in a 2D array. How would the formula change for column-major order?
26.An array of size n is sorted. You need to insert an element into it.
● What is the best-case and worst-case time complexity?
● Justify with reasoning.
27.Suppose you have a sparse matrix with 1000 × 1000 elements, but only 100 elements are
non-zero.
● Estimate the memory required to store it in 2D array representation vs triplet
representation.
● Which is more efficient and why?
28.Two sorted arrays A[1..m] and B[1..n] are merged into a new sorted array.
● Derive the time complexity of merging.
● If both arrays are already partially overlapping (e.g., A ends where B starts), can
merging be done faster?
29.Without using extra space, write an algorithm to shift all zeroes of an array to the end,
while maintaining the order of non-zero elements. What is its time and space complexity?
Pointers
Basic Level (Understanding the Concept)
1. What is a pointer in C? How is it different from a normal variable?
2. Why Study Pointers in Computer Science and Engineering?
3. How Pointers Help in Understanding Computer Science?
4. How do you declare and initialize a pointer? Give an example.
5. What is the meaning of the expression *ptr and &x?
6. What is a NULL pointer? Why is it used?
7. What happens if a pointer is not initialized before use?
Intermediate Level (Applications and Operations)
6. Explain the difference between int *p; and int (*p)[5];.
7. How do you perform pointer arithmetic? Give an example.
8. What is the difference between p++ and ++*p?
9. How are arrays and pointers related in C?
10. Explain how pointers are used to pass parameters to functions.
11.What is a pointer to a pointer (int **ptr)? When is it used?
Advanced Level (Practical Use-Cases)
12. What are function pointers? Provide a simple use-case.
13. Explain the concept of pointer to a structure with an example.
14. What is a dangling pointer? How can it be avoided?
15. What is the difference between malloc(), calloc(), realloc(), and free()?
16. How does pointer usage help in implementing linked lists and trees?
17. What is the difference between static memory allocation and dynamic memory allocation in the
context of pointers?
18. How can a pointer be used to return multiple values from a function?
Q1: Why Study Pointers in Computer Science and Engineering?
● Core concept of C and C++ – Pointers are the foundation for memory management and efficient
programming.
● Direct access to memory – Enables students to understand how data is stored, accessed, and
manipulated in RAM.
● Efficient data structures – Essential for implementing linked lists, trees, graphs, and dynamic
memory allocation.
● Bridges theory and practice – Helps students see how abstract concepts are realized at the
hardware level.
● Crucial for system-level programming – Operating systems, compilers, and embedded systems
rely heavily on pointers.
Q 2: How Pointers Help in Understanding Computer Science
● Memory architecture awareness – Encourages deeper understanding of stack, heap, and address
spaces.
● Improves problem-solving – Enhances skills in designing efficient algorithms and data
manipulation techniques.
● Understanding references in higher languages – Builds foundation for concepts like references,
objects, and garbage collection in Java, Python, etc.
● Closer to machine perspective – Students appreciate the relationship between software and
hardware.
● Gateway to advanced topics – Essential for studying computer organization, operating systems,
networking, and artificial intelligence.
Unit 3: Linked Lists
Part A: Short Answer Questions (Conceptual – 2 to 3 marks each)
1. What are the advantages and disadvantages of linked lists compared to arrays?
2. Define a circular linked list. How is it different from a singly linked list?
3. What is a doubly linked list? Write its node structure.
4. Differentiate between circular linked list and circular doubly linked list.
5. What is a header linked list? Why is it useful?
6. What is the time complexity of:
● Traversing a singly linked list
● Insertion at the beginning of a singly linked list
● Deletion from the end of a singly linked list
Part B: Long Answer Questions (Explanations & Algorithms – 5 to 10 marks each)
7. Write an algorithm to traverse a singly linked list and analyze its time complexity.
8. Write an algorithm to insert a node at the beginning, end, and a specific position in a
singly linked list.
9. Write an algorithm to delete a node from the beginning, end, and a specific position in a
singly linked list.
10.Explain with algorithm the process of insertion and deletion in a circular linked list.
11.Write an algorithm to insert and delete a node in a doubly linked list.
12.Write an algorithm to insert and delete a node in a circular doubly linked list.
13.Compare the performance of insertion and deletion operations in arrays vs linked lists.
14.Explain the advantages and disadvantages of using header linked lists.
Part C: Analytical / Problem-Solving Questions (Applications & Coding – 10 marks each)
15.Write a program to reverse a singly linked list. Analyze its time complexity.
16.Write a function to merge two sorted singly linked lists into one sorted list.
17.Write a program to insert a new node into a circular linked list at the end.
18.Write a function to delete a given node from a circular linked list.
19.Write a program to insert a new node after a given node in a doubly linked list.
20.Write a program to delete the last node of a doubly linked list.
21.Write a program to create and traverse a circular doubly linked list.
22.Write a program to simulate a queue using a circular linked list.
23.Write a program to implement stack operations (push, pop, display) using a linked list.
Tricky Questions on Linked Lists (Unit 3)
24.In a singly linked list, how can you delete a node if only a pointer to that node is given
(not the head pointer)? Is there any limitation to this method?
25.Compare the time complexity of searching for an element in:
● An unsorted singly linked list
● A sorted singly linked list
● A doubly linked list
Which is more efficient and why?
26.Suppose you have a circular linked list with n nodes. If you start traversing from any
node, how many steps will it take to reach the same node again? Prove mathematically.
27.If a doubly linked list has head and tail pointers, explain how insertion at both ends can
be done in O(1) time. Contrast this with singly linked list performance.
28.A circular doubly linked list is used to implement a playlist of songs. Explain how you
would:
● Play the next song
● Play the previous song
● Delete the current song
● Insert a new song after the current one
Discuss why a circular doubly linked list is better suited than other linked list
variants for this application.
Unit 4: Stacks and Queues
Part A: Short Answer Questions (Conceptual – 2 to 3 marks each)
1. Write the array representation of a stack and explain how the top pointer is used.
2. What is a linked stack? State one advantage over array-based stack.
3. What is a queue? Give two real-life examples.
4. Define the following queue types:
○ Linear queue
○ Circular queue
○ Double-ended queue (Deque)
○ Priority queue
5. Differentiate between circular queue and linear queue.
6. Mention two applications of stacks and two applications of queues.
7. What is the time complexity of stack operations (push and pop) and queue operations
(enqueue and dequeue)?
Part B: Long Answer Questions (Explanations & Algorithms – 5 to 10 marks each)
8. Explain the array representation of a stack. Write algorithms for push, pop, and peek.
9. Write an algorithm to implement stack operations using linked list. Analyze the time
complexity.
10.Explain the role of stacks in recursion with an example.
11.Write an algorithm to evaluate a postfix expression using a stack.
12.Convert the following infix expression to postfix and evaluate it:
(A+B)∗(C–D)(A + B) * (C – D)(A+B)∗(C–D)
13.Explain how stacks can be used to solve the Tower of Hanoi problem.
14.Write an algorithm for array representation of a linear queue.
15.Explain how circular queues overcome the limitations of linear queues. Write an
algorithm for enqueue and dequeue operations.
16.Write algorithms for insertion and deletion in a double-ended queue (deque).
17.Explain priority queues. How are they different from normal queues? Write an algorithm
for insertion in a priority queue.
Part C: Analytical / Problem-Solving Questions (Applications & Coding – 10 marks each)
18.Write a C program to implement stack operations (push, pop, display) using arrays.
19.Write a C program to implement stack operations using linked list.
20.Write a program to check whether a given string is a palindrome using a stack.
21.Write a program to evaluate a postfix expression using stacks.
22.Write a program to convert infix expression to postfix using stacks.
23.Write a program to simulate the Tower of Hanoi problem using recursion.
24.Write a C program to implement linear queue operations using arrays.
25.Write a C program to implement circular queue operations.
26.Write a program to insert and delete elements from both ends of a deque.
27.Write a program to implement priority queue operations.
28.Write a program to reverse a queue using a stack.
29.Write a program to check balanced parentheses in an expression using stacks.
Part D: Tricky / Higher-Order Thinking Questions
30.Why is peek operation important in stacks? Can you implement it in O(1) time for both
array and linked stack? Justify.
31.Compare the performance of stack operations in array vs linked representation. Which is
more efficient and why?
32.Suppose a circular queue has size n = 5 and elements are inserted as 10, 20, 30, 40, 50.
After two deletions and two insertions (60, 70), draw the queue and explain the positions
of front and rear.
33.Explain why a priority queue cannot be efficiently implemented using a simple array or
linked list. Suggest an efficient data structure for it.
34.In the Tower of Hanoi problem with n disks, prove that the minimum number of moves
required is 2^n - 1.