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.