Important Data Structure Programs
B.Tech Students & Freshers — Exam, Coding Test and Interview Preparation
A structured collection of important programs covering arrays, searching, sorting, stacks, queues, linked lists, trees, heaps, hashing and graphs.
B.Tech 1st–4th YearFreshersCoding InterviewsDSA Basics
⭐ Top 40 Data Structure Programs
Start with these programs before moving to advanced DSA problems.
| # | Program | Priority |
|---|---|---|
| 1 | Array Traversal | ⭐⭐⭐ |
| 2 | Insert Element in Array | ⭐⭐⭐ |
| 3 | Delete Element from Array | ⭐⭐⭐ |
| 4 | Linear Search | ⭐⭐⭐ |
| 5 | Binary Search | ⭐⭐⭐ |
| 6 | Bubble Sort | ⭐⭐⭐ |
| 7 | Selection Sort | ⭐⭐⭐ |
| 8 | Insertion Sort | ⭐⭐⭐ |
| 9 | Merge Sort | ⭐⭐⭐ |
| 10 | Quick Sort | ⭐⭐⭐ |
| 11 | Stack Using Array | ⭐⭐⭐ |
| 12 | Stack Using Linked List | ⭐⭐⭐ |
| 13 | Infix to Postfix | ⭐⭐⭐ |
| 14 | Postfix Evaluation | ⭐⭐⭐ |
| 15 | Queue Using Array | ⭐⭐⭐ |
| 16 | Circular Queue | ⭐⭐⭐ |
| 17 | Queue Using Linked List | ⭐⭐⭐ |
| 18 | Create Linked List | ⭐⭐⭐ |
| 19 | Insert in Linked List | ⭐⭐⭐ |
| 20 | Delete from Linked List | ⭐⭐⭐ |
| 21 | Reverse Linked List | ⭐⭐⭐ |
| 22 | Find Middle of Linked List | ⭐⭐⭐ |
| 23 | Detect Loop in Linked List | ⭐⭐⭐ |
| 24 | Doubly Linked List | ⭐⭐ |
| 25 | Binary Tree Traversals | ⭐⭐⭐ |
| 26 | Level Order Traversal | ⭐⭐⭐ |
| 27 | Binary Search Tree | ⭐⭐⭐ |
| 28 | BST Search | ⭐⭐⭐ |
| 29 | BST Insertion | ⭐⭐⭐ |
| 30 | BST Deletion | ⭐⭐⭐ |
| 31 | Heap Creation | ⭐⭐ |
| 32 | Heap Sort | ⭐⭐⭐ |
| 33 | Hash Table | ⭐⭐ |
| 34 | DFS | ⭐⭐⭐ |
| 35 | BFS | ⭐⭐⭐ |
| 36 | Graph Representation | ⭐⭐⭐ |
| 37 | Connected Components | ⭐⭐ |
| 38 | Cycle Detection | ⭐⭐⭐ |
| 39 | Shortest Path Basics | ⭐⭐⭐ |
| 40 | Topological Sort | ⭐⭐ |
1. Time & Space Complexity ⭐⭐⭐
Understand Big-O notation
O(1) constant complexity
O(log n) logarithmic complexity
O(n) linear complexity
O(n log n) complexity
O(n²) quadratic complexity
Best, average and worst case
Space complexity of algorithms
2. Array Data Structure Programs ⭐⭐⭐
1. Array traversal
2. Insert element at beginning
3. Insert element at end
4. Insert element at a position
5. Delete element from beginning
6. Delete element from end
7. Delete element from a position
8. Find maximum and minimum
9. Find second largest
10. Reverse an array
11. Rotate left
12. Rotate right
13. Merge two arrays
14. Remove duplicates
15. Find duplicate elements
16. Find missing element
17. Find frequency of elements
18. Find pair with given sum
19. Find common elements
20. Find union and intersection
21. Move zeros to end
22. Separate even and odd elements
23. Find leaders in array
24. Find majority element
25. Find subarray with maximum sum
3. Searching Programs ⭐⭐⭐
26. Linear search
27. Binary search - iterative
28. Binary search - recursive
29. Find first occurrence
30. Find last occurrence
31. Count occurrences of an element
32. Search in rotated sorted array
33. Find floor and ceil
34. Find square root using binary search
4. Sorting Algorithms ⭐⭐⭐
35. Bubble sort
36. Selection sort
37. Insertion sort
38. Merge sort
39. Quick sort
40. Heap sort
41. Counting sort
42. Radix sort
43. Bucket sort
44. Sort an array of 0s, 1s and 2s
45. Sort strings
46. Sort array using custom criteria
Important Sorting Comparison
| Algorithm | Average Time | Typical Use |
|---|---|---|
| Bubble Sort | O(n²) | Learning/basic exams |
| Selection Sort | O(n²) | Basic sorting concepts |
| Insertion Sort | O(n²) | Small/nearly sorted data |
| Merge Sort | O(n log n) | Stable sorting |
| Quick Sort | O(n log n) average | Fast general-purpose sorting |
| Heap Sort | O(n log n) | Heap-based sorting |
5. Stack Programs ⭐⭐⭐
47. Stack using array
48. Push operation
49. Pop operation
50. Peek operation
51. Display stack
52. Stack using linked list
53. Check stack overflow/underflow
54. Reverse a string using stack
55. Check balanced parentheses
56. Infix to postfix conversion
57. Infix to prefix conversion
58. Postfix expression evaluation
59. Prefix expression evaluation
60. Undo-style stack simulation
LIFO: Stack follows
Last In, First Out. Common operations are push, pop and peek.6. Queue Programs ⭐⭐⭐
61. Queue using array
62. Enqueue operation
63. Dequeue operation
64. Peek/front operation
65. Display queue
66. Circular queue
67. Deque implementation
68. Priority queue basics
69. Queue using linked list
70. Queue using two stacks
71. Stack using two queues
FIFO: Queue follows
First In, First Out. Main operations are enqueue and dequeue.7. Singly Linked List ⭐⭐⭐
72. Create a linked list
73. Display linked list
74. Count nodes
75. Insert at beginning
76. Insert at end
77. Insert at a position
78. Delete first node
79. Delete last node
80. Delete node by value
81. Search a node
82. Reverse linked list
83. Find middle node
84. Find nth node from end
85. Detect loop
86. Remove loop
87. Find intersection point
88. Remove duplicates
89. Merge two sorted linked lists
90. Sort linked list
91. Check linked-list palindrome
Basic Node Structure in C
struct Node {
int data;
struct Node *next;
};8. Doubly Linked List ⭐⭐
92. Create doubly linked list
93. Traverse forward
94. Traverse backward
95. Insert at beginning
96. Insert at end
97. Insert at a position
98. Delete from beginning
99. Delete from end
100. Delete a node
101. Reverse doubly linked list
9. Circular Linked List ⭐⭐
102. Create circular linked list
103. Traverse circular list
104. Insert at beginning
105. Insert at end
106. Insert at position
107. Delete first node
108. Delete last node
109. Delete a specific node
110. Split circular linked list
10. Recursion in Data Structures ⭐⭐⭐
111. Factorial using recursion
112. Fibonacci using recursion
113. Binary search recursively
114. Tree traversal recursively
115. Reverse linked list recursively
116. Calculate power recursively
117. Tower of Hanoi
118. Generate subsets
119. Generate permutations
11. Binary Tree Programs ⭐⭐⭐
120. Create binary tree
121. Preorder traversal
122. Inorder traversal
123. Postorder traversal
124. Level-order traversal
125. Count nodes
126. Count leaf nodes
127. Find tree height
128. Find maximum value
129. Find minimum value
130. Search in binary tree
131. Mirror a binary tree
132. Check identical trees
133. Check balanced tree
134. Diameter of binary tree
135. Left view
136. Right view
137. Top view basics
12. Binary Search Tree Programs ⭐⭐⭐
138. Create BST
139. Insert node in BST
140. Search node in BST
141. Delete node from BST
142. Find minimum in BST
143. Find maximum in BST
144. Find inorder successor
145. Find inorder predecessor
146. Validate BST
147. Find kth smallest element
148. Find kth largest element
149. Convert sorted array to BST
13. Heap Programs ⭐⭐
150. Create max heap
151. Create min heap
152. Insert into heap
153. Delete from heap
154. Heapify
155. Build heap
156. Heap sort
157. Find kth largest element
158. Find kth smallest element
159. Priority queue using heap
14. Hashing Programs ⭐⭐
160. Implement hash table
161. Hash function
162. Linear probing
163. Quadratic probing
164. Separate chaining
165. Insert key
166. Search key
167. Delete key
168. Count frequency using hashing
169. Find duplicate elements using hashing
15. Graph Programs ⭐⭐⭐
170. Graph using adjacency matrix
171. Graph using adjacency list
172. DFS traversal
173. BFS traversal
174. Connected components
175. Detect cycle in undirected graph
176. Detect cycle in directed graph
177. Topological sorting
178. Shortest path basics
179. Dijkstra's algorithm
180. Bellman-Ford basics
181. Minimum spanning tree basics
182. Prim's algorithm
183. Kruskal's algorithm
184. Check bipartite graph
Graph Traversals
DFS → Depth First Search BFS → Breadth First Search
Interview Preparation Focus
Arrays
Searching, sorting, duplicates, rotation and subarrays.
Searching, sorting, duplicates, rotation and subarrays.
Linked Lists
Insertion, deletion, reversal, middle node and cycle detection.
Insertion, deletion, reversal, middle node and cycle detection.
Stack
Parentheses, expression conversion and expression evaluation.
Parentheses, expression conversion and expression evaluation.
Queue
Normal queue, circular queue and deque.
Normal queue, circular queue and deque.
Trees
Traversals, height, BST search/insert/delete.
Traversals, height, BST search/insert/delete.
Graphs
BFS, DFS, cycle detection and shortest paths.
BFS, DFS, cycle detection and shortest paths.
Interview rule: For every data structure, understand its purpose, operations, implementation, time complexity, space complexity and real-world use cases.
Practice Strategy
Phase 1 — Foundation
Arrays → Big-O → Searching → Basic sorting.
Phase 2 — Linear Data Structures
Stack → Queue → Linked List → Doubly Linked List → Circular Linked List.
Phase 3 — Non-Linear Structures
Binary Tree → BST → Heap → Hashing.
Phase 4 — Graphs
Adjacency matrix/list → BFS → DFS → cycle detection → shortest path.
Phase 5 — Interview Practice
Solve problems without looking at the solution and explain the complexity of every solution.
Recommended DSA Roadmap
| Stage | Topics | Priority |
|---|---|---|
| 1 | Arrays & Complexity | ⭐⭐⭐ |
| 2 | Searching & Sorting | ⭐⭐⭐ |
| 3 | Stack & Queue | ⭐⭐⭐ |
| 4 | Linked Lists | ⭐⭐⭐ |
| 5 | Binary Trees & BST | ⭐⭐⭐ |
| 6 | Heap & Hashing | ⭐⭐ |
| 7 | Graphs | ⭐⭐⭐ |
| 8 | Interview Problems | ⭐⭐⭐ |