Welcome to my Data Structures and Algorithms (DSA) repository! This is a curated collection of all DSA concepts based on Love Babbar's DSA Sheet, which I've thoroughly studied and practiced. Whether you're a beginner trying to grasp fundamental concepts or an experienced coder revisiting advanced topics, you’ll find this repository helpful.
Let’s dive into the world of problem-solving and explore the core concepts step-by-step.
-
1D Arrays
Arrays are the building blocks of DSA. In this section, you’ll find problems and solutions that focus on manipulating arrays in various ways, including sorting, searching, and optimization techniques. Learn how to deal with:- Finding the largest/smallest elements
- Sorting algorithms
- Sliding window problems
- Kadane’s Algorithm (Maximum Subarray Sum)
-
2D Arrays
Moving from 1D to 2D adds an extra layer of complexity. Master the art of navigating and processing multi-dimensional arrays with topics like:- Matrix operations (transposing, rotating)
- Searching elements in a matrix
- Dynamic programming problems (like finding paths)
-
Strings
Strings are one of the most frequently used data structures in coding challenges. Here, you'll find solutions for:- String manipulation (reversal, palindrome check)
- Pattern matching algorithms (KMP, Rabin-Karp)
- Anagrams, subsequences, and more
-
Linked Lists
Explore the linear data structure that stores data in nodes linked together. This section covers:- Singly and Doubly Linked Lists
- Reversing linked lists
- Detecting cycles (Floyd’s Cycle Detection Algorithm)
-
Stacks and Queues
Stacks and queues simplify many complex problems. This section includes:- Implementation of stack and queue from scratch
- Problems like Next Greater Element, Stock Span
- Queue using stacks and vice versa
-
Hashing
Learn the importance of hashing in efficient searching and storing of data. Topics include:- HashMaps/HashSets for frequency counting
- Collision handling techniques
- Applications like two-sum problem, finding duplicates
-
Recursion & Backtracking
Master the art of solving problems through recursion and backtracking techniques. This section covers:- Basic to advanced recursion problems
- Backtracking in puzzles (N-Queens, Sudoku Solver)
- Subset generation, permutations, and combinations
-
Dynamic Programming (DP)
Dynamic programming helps solve problems by breaking them down into simpler subproblems. This section covers:- Classic DP problems (Fibonacci, Knapsack, Longest Increasing Subsequence)
- Memoization and Tabulation techniques
- Optimization problems with DP
-
Trees
Trees are non-linear data structures with vast applications in real-world problems. This section includes:- Binary Trees and Binary Search Trees (BST)
- Tree traversals (In-order, Pre-order, Post-order)
- Lowest Common Ancestor, Balanced Trees (AVL)
-
Graphs
Graphs are powerful tools for representing real-world networks. This section covers:- Graph representations (Adjacency Matrix, List)
- Depth-First Search (DFS), Breadth-First Search (BFS)
- Shortest path algorithms (Dijkstra, Floyd-Warshall)
- Minimum spanning tree (Kruskal, Prim)
-
Tries
Trie, also known as a prefix tree, is useful for searching strings. Topics include:- Trie construction and basic operations
- Searching words, auto-complete feature
- Longest common prefix
-
Bit Manipulation
Explore how to work with bits to solve problems efficiently. Topics include:- Bitwise operations (AND, OR, XOR)
- Counting set bits, checking power of two
- Tricks for toggling, setting, and clearing bits
-
Greedy Algorithms
Greedy algorithms make locally optimal choices in the hope of finding a global optimum. Topics include:- Activity Selection, Fractional Knapsack
- Huffman Coding
- Job sequencing problem
-
Heaps
Heaps are complete binary trees used to implement priority queues. In this section:- Min-Heap and Max-Heap implementation
- Applications like finding the Kth largest element
- Heap sort
- Complete Coverage: Every major topic and subtopic in DSA is covered. From the basics of arrays to advanced topics like dynamic programming and graphs.
- Well-Structured: Organized in a way that allows you to learn step-by-step, building up from simple to complex concepts.
- Practical Approach: Focused on solving real problems, with well-commented code and explanations.
- Constant Learning: This repository is a continuous work-in-progress as I keep revisiting concepts and adding solutions.
Feel free to explore, contribute, or raise an issue if you find anything missing. I hope this repository helps you on your coding journey just like it has helped me! 😊
If you'd like to add improvements or additional solutions, feel free to submit a pull request! Let's make this a comprehensive resource for everyone.