A growing collection of C++ implementations of core data structures, algorithms, and problem-solving exercises — written while learning and practicing DSA, preparing for interviews, and completing university coursework.
- Overview
- What's Inside
- 仓库 Structure
- Tech Stack
- Prerequisites
- Getting Started
- How to Navigate This Repo
- Contributing
This repository is a personal reference and practice log for Data Structures and Algorithms (DSA) in C++. Each file is a self-contained, runnable program demonstrating one concept, operation, or problem — from basic array manipulation up through trees and graph traversal. It's organized by topic so specific concepts are easy to find and review.
| Topic | What you'll find |
|---|---|
| Arrays | Insertion, deletion, copying, linear/binary search, prime-number filtering, largest/smallest element, even/odd counting |
| Linked Lists | Singly, doubly, and circular linked lists — insertion, deletion, reversal, palindrome check, class-based implementations |
| Stacks | Custom stack implementation (array & linked-list based), reversing a stack using another stack, reversing a stack using recursion |
| Queues | Linear queue, circular queue, double-ended queue (deque), priority queue using arrays |
| Trees | Binary trees and Binary 搜索 Trees (BST) — insertion, deletion, searching (iterative & recursive), height, diameter, balance check, identical-tree check, node counting, all four traversal orders (pre/in/post/level) |
| Graphs | Graph representation via adjacency matrix/list, BFS traversal (2D array and vector/list/map based) |
| Sorting Algorithms | Bubble sort (with variations), insertion sort |
| Time Complexity | Practical demonstrations of loop-based and recursive time complexity |
| Heap Memory | Dynamic memory allocation examples in C++ |
| Algorithm Examples | Fibonacci series, recursive factorial, powers of two |
| LeetCode Problems | Solutions to selected LeetCode-style problems, including integer overflow examples/fixes |
| University Codes (Manual) | A dedicated set of BST, circular list, doubly list, and queue solutions organized to match university coursework/assignments |
Data-Structure-Algorithms/
├── README.md
├── .gitignore
│
├── Algorithms-Examples/ # Fibonacci, factorial, powers of two
├── Heap-Memory/ # Dynamic memory allocation demos
├── Time-Complexity/ # Loop & recursion complexity examples
├── Leet-Code-Problems/ # LeetCode-style problems & solutions
│
├── Operations-On-Arrays/ # Array insertion/deletion/search/etc.
├── Sorting-Algorithms-For-Array/ # Bubble sort, insertion sort
│
├── Linked-List/
│ ├── Singly-Linked-List/
│ │ ├── Linked-List-Insertion/
│ │ └── Linked-List-Deletion/
│ ├── Doubly-Linked-List/
│ ├── Circular-Linked-List/
│ └── Operations-On-Linked-List/ # Reversal, palindrome check
│
├── Stack-Problems/ # Custom stack + stack reversal problems
├── Queue-Problems/ # Linear, circular, deque, priority queue
│
├── Trees-Problems/
│ ├── Binary-Tree/
│ ├── Binary-搜索-Tree/
│ │ ├── Insertion-In-BST/
│ │ ├── Deleting-In-BST/
│ │ ├── 搜索ing-In-BST/
│ │ ├── Checking-Tree-BST/
│ │ ├── Checking-Height-BST/
│ │ ├── Counting-Nodes-BST/
│ │ └── BST-Interview-Questions/ # Height, diameter, balance, identical trees
│ ├── Tree-Pre-Order-Traversal/
│ ├── Tree-In-Order-Traversal/
│ ├── Tree-Post-Order-Traversal/
│ └── Tree-Level-Order-Traversal/
│
├── Graphs/ # Adjacency matrix representation
│ └── BFS-Traversal/ # BFS via 2D array and vector/list/map
│
└── University-Codes-Manual/ # BST, circular/doubly list & queue tasks
├── BST/
├── Circular-List-Tasks/
├── Doubly-List-Tasks/
├── Queue-Problem-Set/
└── Singly-List-Task/
| Component | Details |
|---|---|
| Language | C++ (mostly C++11/14-style code, standard STL where used) |
| Standard Library | <iostream>, <vector>, <queue>, <stack>, <map>, etc. (varies per file) |
| Interface | Command-line, single-file programs |
| Compiler | Any standard C++ compiler — g++ (MinGW/Linux/macOS) or MSVC |
Most files are platform-independent standard C++; a few interview-style university files were originally developed/tested on Windows in VS Code, but don't rely on Windows-only headers.
You just need a working C++ compiler:
g++(via MinGW-w64 on Windows, or pre-installed on most Linux distros/macOS with Xcode Command Line Tools), or- Any IDE with a bundled compiler (Visual Studio, CLion, Code::Blocks, Dev-C++, etc.)
You'll also need Git if you want to clone the repo (or just download the ZIP from GitHub instead).
git clone https://github.com/abmdevx/Data-Structure-Algorithms.git
cd Data-Structure-AlgorithmsNo Git? Click Code → Download ZIP on the GitHub page instead, then extract it.
Every .cpp file in this repo is self-contained — just compile the one you want to explore:
g++ Linked-List/Singly-Linked-List/Ultimate_Singly_List_Code.cpp -o output
./output # Linux/macOS
output.exe # WindowsSwap in the path to whichever file interests you — no project-wide build system or dependencies required.
- Looking for a specific data structure? Go straight to its top-level folder (
Linked-List/,Trees-Problems/,Queue-Problems/, etc.). - Preparing for interviews? Check
Leet-Code-Problems/andTrees-Problems/Binary-搜索-Tree/BST-Interview-Questions/for classic interview-style problems (height, diameter, balance checks, identical trees, etc.). - 已关注 a specific operation (insertion, deletion, traversal)? Many topics are further split into subfolders by operation, e.g.
Linked-List/Singly-Linked-List/Linked-List-Insertion/vsLinked-List-Deletion/. - 新建 to a topic? Files prefixed
Ultimate_(e.g.Ultimate_Code_For_Stack.cpp,Ultimate_Singly_List_Code.cpp) are usually the most complete, consolidated implementation for that structure — a good starting point before diving into the smaller, operation-specific files. - Curious about university-specific solutions?
University-Codes-Manual/mirrors several of the same topics but organized to match specific coursework/assignment structure.
If you find this repository helpful:
- ⭐ Star it to show support.
- 🍴 复刻 it and add your own solutions or improvements.
- 📬 Open a pull request if you'd like to contribute a new algorithm, fix a bug, or improve an existing implementation.