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.

#ProgramPriority
1Array Traversal⭐⭐⭐
2Insert Element in Array⭐⭐⭐
3Delete Element from Array⭐⭐⭐
4Linear Search⭐⭐⭐
5Binary Search⭐⭐⭐
6Bubble Sort⭐⭐⭐
7Selection Sort⭐⭐⭐
8Insertion Sort⭐⭐⭐
9Merge Sort⭐⭐⭐
10Quick Sort⭐⭐⭐
11Stack Using Array⭐⭐⭐
12Stack Using Linked List⭐⭐⭐
13Infix to Postfix⭐⭐⭐
14Postfix Evaluation⭐⭐⭐
15Queue Using Array⭐⭐⭐
16Circular Queue⭐⭐⭐
17Queue Using Linked List⭐⭐⭐
18Create Linked List⭐⭐⭐
19Insert in Linked List⭐⭐⭐
20Delete from Linked List⭐⭐⭐
21Reverse Linked List⭐⭐⭐
22Find Middle of Linked List⭐⭐⭐
23Detect Loop in Linked List⭐⭐⭐
24Doubly Linked List⭐⭐
25Binary Tree Traversals⭐⭐⭐
26Level Order Traversal⭐⭐⭐
27Binary Search Tree⭐⭐⭐
28BST Search⭐⭐⭐
29BST Insertion⭐⭐⭐
30BST Deletion⭐⭐⭐
31Heap Creation⭐⭐
32Heap Sort⭐⭐⭐
33Hash Table⭐⭐
34DFS⭐⭐⭐
35BFS⭐⭐⭐
36Graph Representation⭐⭐⭐
37Connected Components⭐⭐
38Cycle Detection⭐⭐⭐
39Shortest Path Basics⭐⭐⭐
40Topological 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

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

AlgorithmAverage TimeTypical Use
Bubble SortO(n²)Learning/basic exams
Selection SortO(n²)Basic sorting concepts
Insertion SortO(n²)Small/nearly sorted data
Merge SortO(n log n)Stable sorting
Quick SortO(n log n) averageFast general-purpose sorting
Heap SortO(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.
Linked Lists
Insertion, deletion, reversal, middle node and cycle detection.
Stack
Parentheses, expression conversion and expression evaluation.
Queue
Normal queue, circular queue and deque.
Trees
Traversals, height, BST search/insert/delete.
Graphs
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

StageTopicsPriority
1Arrays & Complexity⭐⭐⭐
2Searching & Sorting⭐⭐⭐
3Stack & Queue⭐⭐⭐
4Linked Lists⭐⭐⭐
5Binary Trees & BST⭐⭐⭐
6Heap & Hashing⭐⭐
7Graphs⭐⭐⭐
8Interview Problems⭐⭐⭐