This repository includes comprehensive implementations of fundamental data structures using the C programming language.
All code is written and implemented by me with simplicity and clarity in mind.
This repository serves as a complete reference for essential data structures in computer science, implemented in C programming language. It covers three fundamental categories of data structures: Linked Lists, Stacks, and Queues. Each implementation is designed with educational purposes in mind, featuring clean, well-commented code that demonstrates core concepts and operations.
The repository is perfect for:
- Students learning data structures and algorithms
- Developers looking for reference implementations
- Educators seeking teaching materials
- Interview preparation for programming roles
- Academic projects requiring data structure implementations
- Complete Coverage: Implements multiple variations of each data structure
- Educational Focus: Code is written with clarity and learning in mind
- Real-world Applications: Each implementation includes practical examples
- Multiple Approaches: Shows both array-based and linked list-based implementations
- Beginner Friendly: Well-commented code with clear function names
- Comprehensive Operations: Each structure includes all essential operations
- Singly Linked List - Basic linear linked structure
- Singly Circular Linked List - Circular variation of singly linked list
- Doubly Linked List - Bidirectional linked structure
- Doubly Circular Linked List - Circular variation of doubly linked list
- Stack using Array - Array-based implementation
- Stack using Linked List - Dynamic memory implementation
- Stack using Doubly Linked List - Enhanced linked list approach
- Queue using Array - Static array implementation
- Queue using Linked List - Dynamic implementation
- Circular Queue - Efficient circular buffer implementation
Each data structure includes relevant functions such as:
- Insert at beginning
- Insert at end
- Insert at specific position
- Delete from beginning
- Delete from end
- Delete from specific position
- Search a node
- Display list
- Count nodes
- Reverse the list
- Push (insert element)
- Pop (remove top element)
- Peek/Top (view top element)
- isEmpty (check if stack is empty)
- isFull (check if stack is full - for array implementation)
- Display stack
- Count elements
- Enqueue (insert element)
- Dequeue (remove front element)
- Front (view front element)
- Rear (view rear element)
- isEmpty (check if queue is empty)
- isFull (check if queue is full - for array implementation)
- Display queue
- Count elements
LinkedList/
│
├── Linked List/
│ ├── singly_linkedlist.c → Singly Linked List
│ ├── singly_circular.c → Singly Circular Linked List
│ ├── doubly_linkedlist.c → Doubly Linked List
│ └── doubly_circular.c → Doubly Circular Linked List
│
├── Stack/
│ ├── stack_array.c → Stack using Array
│ ├── stack_linkedlist.c → Stack using Linked List
│ └── stack_doubly_linkedlist.c → Stack using Doubly Linked List
│
└── Queue/
├── queue_array.c → Queue using Array
├── queue_linkedlist.c → Queue using Linked List
└── queue_circular.c → Circular Queue
Use any C compiler like GCC to compile and run the programs:
# For Windows (using GCC)
gcc filename.c -o output.exe
output.exe
# For Linux/Mac
gcc filename.c -o output
./output# Navigate to the desired folder
cd "Linked List"
# Compile the singly linked list program
gcc singly_linkedlist.c -o singly_linkedlist.exe
# Run the program
singly_linkedlist.exeMake sure to navigate to the correct folder containing the
.cfile before compiling.
-
Clone the repository:
git clone https://github.com/shivangipatel2508/LinkedList.git
-
Navigate to desired data structure:
cd LinkedList/Stack -
Compile and run:
gcc stack_array.c -o stack_array.exe stack_array.exe
- Memory Management: Dynamic allocation and deallocation
- Pointer Manipulation: Advanced pointer concepts and operations
- Algorithm Efficiency: Time and space complexity considerations
- Data Structure Design: Choosing appropriate structures for different use cases
- Error Handling: Robust error checking and edge case management
- Simple and beginner-friendly code
- Modular and reusable functions
- Console-based user interaction
- Clear function names and structure
- Comprehensive coverage of fundamental data structures
- Well-organized folder structure for easy navigation
- Detailed comments explaining complex operations
- Input validation and error handling
- Cross-platform compatibility
Each implementation includes:
- Basic functionality tests
- Edge case handling
- Memory management verification
- Performance considerations
This repository complements the following computer science topics:
- Data Structures and Algorithms
- Computer Programming in C
- Memory Management
- Algorithm Analysis
- Software Design Patterns
Feel free to contribute by:
- Adding new data structure implementations
- Improving existing code
- Adding more comprehensive examples
- Enhancing documentation
- Reporting bugs or issues
If you have any feedback or suggestions, feel free to reach out or open an issue on this repository.
This project is open source and available under the MIT License.