A clean, from-scratch C++ implementation of core data structures for learning, practice, and interview preparation.
Data-Structures-CPP is a comprehensive educational repository that implements fundamental data structures without relying on STL containers for core behavior.
It is designed to help learners understand how each structure works internally and practice common operations with clear, template-based C++ code.
| Category | Highlights |
|---|---|
| π¦ Array-Based Structures | Dynamic list behavior, LIFO stack, FIFO queue, circular queue buffer |
| π Linked Structures | Singly, circular, doubly linked lists + linked queue and stack |
| π³ Trees | Binary Search Tree with insert/search/delete + traversals |
| π§© Generic Design | Most structures are implemented as C++ templates |
| π― Learning Focus | Covers insertion, deletion, traversal, searching, and utility operations |
| # | Data Structure | Category | File |
|---|---|---|---|
| 1 | Array Based List | Array-Based | array_based_list/array_based_list.h |
| 2 | Stack Based Array | Array-Based | stack_based_array/stackADT.h |
| 3 | Queue Based Array | Array-Based | queue_based_array/queueAdt.h |
| 4 | Circular Queue Based Array | Array-Based | queue_based_array/CircularQueueAdt.h |
| 5 | Singly Linked List | Linked List-Based | linked_lists/list.h |
| 6 | Circular Linked List | Linked List-Based | linked_lists/CircularLinkedLlist.h |
| 7 | Doubly Linked List | Linked List-Based | linked_lists/DoublyLinkedList.h |
| 8 | Queue Linked List | Linked List-Based | linked_lists/QueueLinkedList.h |
| 9 | Stack Linked List | Linked List-Based | linked_lists/StackLinkedList.h |
| 10 | Binary Tree (BST-style operations) | Tree Structures | BinaryTree/Binary_Tree.h |
Note: Complexities are standard expected averages/worst-cases for these data structures and operations.
| Data Structure | Access | Search | Insert | Delete |
|---|---|---|---|---|
| Array Based List | O(1) |
O(n) |
O(n) |
O(n) |
| Stack (Array / Linked) | O(1) (top) |
O(n) |
O(1) (push) |
O(1) (pop) |
| Queue (Array / Linked) | O(1) (front/back) |
O(n) |
O(1) (enqueue) |
O(1) (dequeue) |
| Circular Queue | O(1) (front/back) |
O(n) |
O(1) |
O(1) |
| Singly Linked List | O(n) |
O(n) |
O(1)* / O(n) |
O(1)* / O(n) |
| Doubly Linked List | O(n) |
O(n) |
O(1)* / O(n) |
O(1)* / O(n) |
| Circular Linked List | O(n) |
O(n) |
O(1)* / O(n) |
O(1)* / O(n) |
| Binary Tree (BST) | O(h) |
O(h) |
O(h) |
O(h) |
Complexity assumptions
his tree height (O(log n)average for balanced trees,O(n)worst-case for skewed trees).*indicates operations that can be constant-time when a direct node position/pointer is already known.
Data-Structures-CPP/
βββ array_based_list/
β βββ array_based_list.h
βββ stack_based_array/
β βββ stackADT.h
βββ queue_based_array/
β βββ queueAdt.h
β βββ CircularQueueAdt.h
βββ linked_lists/
β βββ list.h
β βββ CircularLinkedLlist.h
β βββ DoublyLinkedList.h
β βββ QueueLinkedList.h
β βββ StackLinkedList.h
βββ BinaryTree/
β βββ Binary_Tree.h
βββ LICENSE
βββ README.md
git clone https://github.com/Farouk0Elsayed/Data-Structures-CPP.git
cd Data-Structures-CPP#include "array_based_list/array_based_list.h"
#include <iostream>
using namespace std;
int main() {
arrayListType<int> arr(10);
arr.pushback(5);
arr.pushback(10);
arr.print();
}g++ -std=c++17 -Wall -Wextra -pedantic main.cpp -o app
./app#include "array_based_list/array_based_list.h"
arrayListType<int> numbers(8);
numbers.pushback(3);
numbers.pushback(9);
numbers.insertat(1, 7);
numbers.removeAll(3);
numbers.print();#include "stack_based_array/stackADT.h"
StackAdt<int> st(5);
st.push(10);
st.push(20);
st.pop();
cout << st.get_top() << endl;#include "BinaryTree/Binary_Tree.h"
Binary_Tree tree;
tree.insert(50);
tree.insert(20);
tree.insert(80);
cout << tree.search(20) << endl; // 1 (true)
tree.Delete_Node(20);- Language: C++
- Paradigms: Object-Oriented Programming, Generic Programming (templates)
- Core Concepts: Pointers, Dynamic Memory, Recursion, Traversal, ADTs
- Design Focus: From-scratch implementation and algorithmic thinking
flowchart TD
A[Start Learning Data Structures] --> B{Choose Structure Type}
B --> C[Array-Based]
B --> D[Linked List-Based]
B --> E[Tree]
C --> C1[Insert / Delete / Access]
D --> D1[Insert / Delete / Traverse]
E --> E1[Insert / Search / Delete]
C1 --> F[Analyze Complexity]
D1 --> F
E1 --> F
F --> G[Build Strong DSA Foundations]
flowchart LR
R[Repository] --> A[array_based_list]
R --> S[stack_based_array]
R --> Q[queue_based_array]
R --> L[linked_lists]
R --> T[BinaryTree]
Contributions are welcome and appreciated.
Contribution steps
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-change) - Commit your changes (
git commit -m "Add amazing change") - Push to your branch (
git push origin feature/amazing-change) - Open a Pull Request
This project is licensed under the MIT License.
See LICENSE for details.
FaroukOElSayed
GitHub: @Farouk0Elsayed
If this repository helps you, please consider giving it a star β it helps the project grow and reach more learners.