DSA
A well-organized repository covering core Data Structures and Algorithms, from fundamentals to advanced topics. It’s designed for systematic learning, coding interview preparation, and reference implementations, with topic-wise structure and clean, practical solutions
Install / Use
/learn @Gaurav14cs17/DSAREADME
<a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=600&size=22&pause=1000&color=6C63FF¢er=true&vCenter=true&width=650&lines=Master+DSA+with+800%2B+Problems+%26+40+Topics;From+Arrays+to+Advanced+DP+Optimizations;Your+Complete+Interview+Preparation+Guide" alt="Typing SVG" /></a>
<br/> <!-- Badges --> <p> <a href="https://github.com/Gaurav14cs17/DSA/stargazers"><img src="https://img.shields.io/github/stars/Gaurav14cs17/DSA?style=for-the-badge&logo=github&color=f4c430&logoColor=white" alt="Stars"/></a> <a href="https://github.com/Gaurav14cs17/DSA/network/members"><img src="https://img.shields.io/github/forks/Gaurav14cs17/DSA?style=for-the-badge&logo=github&color=6c63ff&logoColor=white" alt="Forks"/></a> <a href="https://github.com/Gaurav14cs17/DSA/issues"><img src="https://img.shields.io/github/issues/Gaurav14cs17/DSA?style=for-the-badge&logo=github&color=ff6b6b&logoColor=white" alt="Issues"/></a> <a href="https://github.com/Gaurav14cs17/DSA/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Gaurav14cs17/DSA?style=for-the-badge&logo=opensourceinitiative&color=00c853&logoColor=white" alt="License"/></a> </p> <p> <a href="https://Gaurav14cs17.github.io/DSA/"><img src="https://img.shields.io/badge/📚_LIVE_DOCUMENTATION-Visit_Now-6c63ff?style=for-the-badge&labelColor=1a1a2e" alt="Live Docs"/></a> </p> </div>✨ What Makes This Special?
<table> <tr> <td width="50%">🎯 Comprehensive Coverage
-
41 carefully curated topics
-
From basic arrays to advanced loop fusion
-
Interview-focused problem selection
📐 Mathematical Rigor
-
Formal proofs and derivations
-
Complexity analysis for every algorithm
-
Visual step-by-step walkthroughs
💻 Production-Ready Code
-
Clean, well-documented Python implementations
-
Multiple approaches for each problem
-
Optimized solutions with explanations
🗺️ Structured Learning Path
-
Progressive difficulty levels
-
Clear prerequisites and dependencies
-
Practice roadmaps for each topic
🗂️ Complete Topic Index
📦 Core Data Structures
<div align="center">| # | Topic | Level | Problems | Description | |:-:|:------|:-----:|:--------:|:------------| | 01 | Arrays | 🟢 Easy | 50+ | Two pointers, prefix sum, matrix operations | | 02 | Strings | 🟢 Easy | 50+ | Pattern matching, palindromes, anagrams | | 03 | Linked Lists | 🟢 Easy | 40+ | Reversal, merge, cycle detection | | 04 | Stacks | 🟡 Medium | 35+ | Monotonic stack, expression evaluation | | 05 | Queues | 🟡 Medium | 25+ | BFS, deque, priority queues | | 06 | Hash Tables | 🟢 Easy | 40+ | Frequency counting, two sum pattern | | 07 | Trees | 🟡 Medium | 60+ | Traversal, construction, LCA | | 08 | Binary Search Trees | 🟡 Medium | 25+ | Validation, operations, balancing | | 09 | Heaps | 🟡 Medium | 30+ | Top-K, merge K streams, two heaps | | 10 | Graphs | 🔴 Hard | 80+ | BFS, DFS, shortest path, MST | | 11 | Tries | 🟡 Medium | 15+ | Autocomplete, word search | | 12 | Segment Trees | 🔴 Hard | 15+ | Range queries, lazy propagation | | 13 | Union-Find | 🟡 Medium | 15+ | Connected components, cycle detection |
</div>🧮 Essential Algorithms
<div align="center">| # | Topic | Level | Problems | Description | |:-:|:------|:-----:|:--------:|:------------| | 14 | Sorting | 🟢 Easy | 20+ | Comparison sorts, counting sort, custom | | 15 | Binary Search | 🟡 Medium | 40+ | Sorted array, search on answer, 2D | | 16 | Recursion | 🟡 Medium | 25+ | Backtracking, memoization, D&C | | 17 | Backtracking | 🟡 Medium | 30+ | Permutations, subsets, N-Queens | | 18 | Dynamic Programming | 🔴 Hard | 100+ | 1D, 2D, knapsack, tree DP, bitmask | | 19 | Greedy | 🟡 Medium | 25+ | Interval scheduling, activity selection | | 20 | Divide & Conquer | 🟡 Medium | 15+ | Merge sort pattern, quick select | | 21 | Bit Manipulation | 🟡 Medium | 25+ | XOR tricks, bit counting, subsets |
</div>🎯 Problem-Solving Patterns
<div align="center">| # | Topic | Level | Problems | Description | |:-:|:------|:-----:|:--------:|:------------| | 22 | Two Pointers | 🟢 Easy | 30+ | Opposite direction, same direction | | 23 | Sliding Window | 🟡 Medium | 25+ | Fixed size, variable size | | 24 | Graph Algorithms | 🔴 Hard | 100+ | Advanced BFS/DFS, network flow | | 25 | Tree Algorithms | 🔴 Hard | 80+ | Binary lifting, HLD, centroid | | 26 | Sweep Line | 🟡 Medium | 20+ | Event processing, interval problems | | 27 | Advanced Trees | 🔴 Hard | 30+ | AVL, Red-Black, B-Trees | | 28 | String Algorithms | 🔴 Hard | 40+ | KMP, Z-algorithm, suffix array | | 29 | Computational Geometry | 🔴 Hard | 20+ | Convex hull, line intersection |
</div>⚡ Advanced Topics
<div align="center">| # | Topic | Level | Problems | Description | |:-:|:------|:-----:|:--------:|:------------| | 30 | Number Theory | 🔴 Hard | 50+ | GCD, prime sieve, modular arithmetic | | 31 | Combinatorics | 🔴 Hard | 50+ | Counting, generating functions | | 32 | Game Theory | 🔴 Hard | 25+ | Nim, Sprague-Grundy, minimax | | 33 | Matrix Exponentiation | 🔴 Hard | 25+ | Fast Fibonacci, linear recurrence | | 34 | Sqrt Decomposition | 🔴 Hard | 20+ | Mo's algorithm, block decomposition | | 35 | Persistent DS | 🔴 Hard | 20+ | Persistent segment tree, versioning | | 36 | Randomized | 🟡 Medium | 25+ | Reservoir sampling, skip lists | | 37 | Interval Trees | 🟡 Medium | 30+ | Interval scheduling, range updates | | 38 | Online Algorithms | 🔴 Hard | 25+ | LRU cache, streaming algorithms | | 39 | Approximation | 🔴 Hard | 20+ | Set cover, TSP approximation | | 40 | DP Optimizations | 🔴 Hard | 60+ | Convex hull trick, divide & conquer | | 41 | Loop Fusion & Online | 🔴 Hard | 30+ | Welford, Kadane, recurrence relations |
</div>🗺️ Complete Topic Overview
<div align="center"> <img src="./assets/dsa-topics-overview.svg" alt="DSA Topics Overview - All 40 Topics" width="100%"/> </div>🚀 Learning Roadmap
<div align="center"> 🎯 DSA MASTERY PATH 🎯
+-----------------------------------------------------------------+
| |
| WEEK 1-2 WEEK 3-4 WEEK 5-6 WEEK 7+ |
| --------- --------- --------- -------- |
| |
| 📦 Arrays 🧮 Sorting 🌲 Trees 🔴 DP |
| 📝 Strings 🔍 Binary 📊 Graphs ⚡ Adv. |
| 🔗 Lists Search 🏔️ Heaps 📐 Math |
| #️⃣ Hash Maps ↩️ Recursion 🔀 Union-Find |
| |
| ------------------------------------------------------------ |
| 🟢 FOUNDATION 🟡 INTERMEDIATE 🔴 ADVANCED ⭐ EXPERT |
| |
+-----------------------------------------------------------------+
</div>
📈 Suggested Weekly Plan
| Week | Focus Area | Topics | Goal | |:----:|:-----------|:-------|:-----| | 1-2 | Foundations | Arrays, Strings, Hash Maps | Build strong basics | | 3-4 | Core DS | Linked Lists, Stacks, Queues | Master linear structures | | 5-6 | Search & Sort | Binary Search, Sorting | Understand divide & conquer | | 7-8 | Recursion | Recursion, Backtracking | Think recursively | | 9-10 | Trees | Binary Trees, BST, Heaps | Tree traversal mastery | | 11-12 | Graphs | BFS, DFS, Shortest Path | Graph algorithms | | 13-16 | DP | 1D, 2D, Advanced DP | Dynamic programming | | 17+ | Advanced | Segment Trees, Number Theory | Competition level |
📐 Complexity Cheat Sheet
<div align="center">| Algorithm | Time | Space | When to Use |
|:----------|:----:|:-----:|:------------|
| Binary Search | O(log n) | O(1) | Sorted data, monotonic function |
| Two Pointers | O(n) | O(1) | Sorted arrays, palindromes |
| Sliding Window | O(n) | O(k) | Subarray/substring problems |
| BFS | O(V+E) | O(V) | Shortest path (unweighted) |
| DFS | O(V+E) | O(V) | Path finding, cycle detection |
| Dijkstra | O((V+E)log V) | O(V) | Shortest path (weighted) |
| Merge Sort | O(n log n) | O(n) | Stable sort needed |
| Quick Sort | O(n log n) | O(log n) | General purpose sorting |
| DP (1D) | O(n) | O(n) | Optimal substructure |
|
