Skip to content

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.

Notifications You must be signed in to change notification settings

kanikaimerb/Data-Structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‚ Data Structures in C

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.


πŸ“Œ Explanation of Each Topic

πŸ”Ή Linked List

A linked list is a collection of nodes where each node contains:

  1. Data (the actual value).
  2. 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.


πŸ”Ή Stack (LIFO - Last In, First Out)

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.

Basic Operations:

  • Push: Add an item to the stack.
  • Pop: Remove the top item from the stack.
  • Peek: Check the top item without removing it.

πŸ”Ή Queue (FIFO - First In, First Out)

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.

Basic Operations:

  • Enqueue: Add an item to the queue.
  • Dequeue: Remove the front item from the queue.

πŸ”Ή Sorting Algorithms

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 Algorithms

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)

πŸ”Ή Postfix Notation (Reverse Polish Notation)

In Postfix Notation, the operator comes after the operands instead of between them.

🎯 Why Learn Data Structure?

βœ… 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.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages