Data Structures and Algorithms (DSA)
Data Structures and Algorithms (DSA)
11. Perform the following operations on a stack using push and pop: Sequence: PUSH(10),
PUSH(20), POP, PUSH(30), POP\text{Sequence: PUSH(10), PUSH(20), POP,
PUSH(30), POP}Sequence: PUSH(10), PUSH(20), POP, PUSH(30), POP Show the
stack after each operation.
12. Write the steps to sort the array [8,3,1,7,0,10,2][8, 3, 1, 7, 0, 10, 2][8,3,1,7,0,10,2] using
bubble sort.
13. Implement the following queue operations: Enqueue(5), Enqueue(10), Dequeue,
Enqueue(15). Show the state of the queue.
14. Represent the graph below using an adjacency matrix: Nodes: A, B, C, D; Edges: A-B,
B-C, C-D, D-A\text{Nodes: A, B, C, D; Edges: A-B, B-C, C-D, D-A}Nodes: A, B, C, D;
Edges: A-B, B-C, C-D, D-A
15.
Long Answer Questions (10 Marks Each)
16. Write and explain the algorithm for binary search. Analyze its time complexity.
17. What is a hash table? Explain collision resolution techniques with examples.
18. Discuss Dijkstra’s algorithm for finding the shortest path in a graph. Solve a problem
using this algorithm.
19. Compare and contrast the merge sort and quick sort algorithms with examples.
20. Explain the different types of tree traversal methods with examples.
Programming/Code-Based Questions
21. Write a program to implement a linked list and perform insert, delete, and display
operations.
22. Write a function to reverse a string using a stack.
23. Implement a program to find the factorial of a number using recursion.
24. Write a program to check whether a given string is a palindrome using a queue.
25. Implement a binary search algorithm in C++/Python.