A comprehensive Generalized Data Structure Library (GDSL) implemented in C++ using templates to provide reusable, type-safe, and efficient implementations of commonly used data structures. Ideal for learning, projects, and competitive programming.
Generalized-Data-Structure-Library
│
├── library
│ └── gdsl.cpp # All data structures implemented here
│
├── examples
│ └── demo.cpp # Example usage of the library
│
├── docs
│ └── project_overview.md # Documentation and overview of data structures
│
├── README.md # Project description and guide
├── LICENSE # MIT License
└── .gitignore # Git ignore file
The library includes generic implementations of:
| Type | Node Class | Functionality Class |
|---|---|---|
| Singly Linear | SinglyLLLnode |
SinglyLLL |
| Singly Circular | SinglyCLLnode |
SinglyCLL |
| Doubly Linear | DoublyLLLnode |
DoublyLLL |
| Doubly Circular | DoublyCLLnode |
DoublyCLL |
| Stack | Stacknode |
Stack |
| Queue | Queuenode |
Queue |
- Insertion: At beginning, end, or any position
- Deletion: From beginning, end, or any position
- Display: Print elements in order
- Count: Get number of elements
- Stack & Queue: Standard push/pop/enqueue/dequeue operations
- Generic Templates: Fully type-safe implementations using C++ templates.
- Reusable & Modular: Single file (
gdsl.cpp) can be included in any project. - Complete Coverage: Includes all common linear and circular data structures.
- Clean Interface: Simple and consistent function naming for all structures.
- Documentation Ready: Functions are documented, making it beginner-friendly.
- Efficient & Lightweight: Minimal memory overhead, optimized operations.
- Example-driven:
examples/demo.cppshows usage of all data structures.
#include "../library/gdsl.cpp"
int main() {
SinglyLLL<int> list;
list.InsertFirst(10);
list.InsertLast(20);
list.InsertAtPos(15, 2);
list.Display(); // Output: | 10 | -> | 15 | -> | 20 | -> NULL
list.DeleteAtPos(2);
list.Display(); // Output: | 10 | -> | 20 | -> NULL
cout << "Total nodes: " << list.Count() << endl;
return 0;
}Detailed documentation for each data structure and its functions is available in the docs/project_overview.md.
- Clone the repository:
git clone https://github.com/<your-username>/Generalized-Data-Structure-Library.git- Compile the library and demo:
g++ examples/demo.cpp -o demo
./demo- Include
gdsl.cppin your own projects to use the data structures.
This project is licensed under the MIT License – see the LICENSE file for details.
Sahil Rajaram Thorat
- GitHub: github.com/SahilThorat11
- Email: sahilrajaramthorat11@gmail.com