This repository contains implementations of fundamental data structures and algorithms using C programming language. These programs help understand how data is stored, accessed, and manipulated efficiently.
📖 Reference Book: Data Structures Using C (Second Edition) by Reema Thareja.
A linked list is a collection of nodes where each node contains:
- Data (the actual value).
- Pointer to the next node.
Unlike arrays, linked lists don’t require continuous memory and can grow dynamically. They are useful for implementing stacks, queues, and graphs.
A stack follows the LIFO principle, meaning:
- The last item added is the first to be removed.
- Think of a stack of plates—you remove the top plate first.
- Push: Add an item to the stack.
- Pop: Remove the top item from the stack.
- Peek: Check the top item without removing it.
A queue follows the FIFO principle, meaning:
- The first item added is the first to be removed.
- Think of a line at a ticket counter—people leave in the order they arrive.
- Enqueue: Add an item to the queue.
- Dequeue: Remove the front item from the queue.
Sorting is the process of arranging data in order (ascending or descending).
- 🟢 Bubble Sort – Compares adjacent elements and swaps if needed. (Simple but slow)
- 🟢 Insertion Sort – Picks one element at a time and inserts it in the correct position. (Good for small data)
- 🟢 Quick Sort – Uses a pivot to divide the array and sort both parts separately. (Fast for large data)
- 🟢 Selection Sort – Finds the smallest element and swaps it to its correct position. (Easy but inefficient)
Searching is used to find an element in a collection of data.
- 🔍 Linear Search – Checks each element one by one. (Simple but slow)
- 🔍 Binary Search – (Only for sorted data) Divides the list into halves and searches efficiently. (Very fast)
In Postfix Notation, the operator comes after the operands instead of between them.
✅ They are fundamental for coding, interviews, and real-world applications.
✅ They optimize how data is stored and retrieved.
✅ They help in building complex applications like databases, compilers, and operating systems.