Skip to content

Sayar-212/CompleteDSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSA Notes - Complete Guide for 2nd Year Engineering

Comprehensive Data Structures and Algorithms reference with 200+ implementations covering all topics from basic to advanced competitive programming.


📚 All Topics Covered (23 Topics - 200+ Algorithms)

✅ 01. Arrays (22 Algorithms)

Reverse, Find Max/Min, Kadane's Algorithm, Rotate Array, Two Sum, Three Sum, Remove Duplicates, Move Zeros, Find Missing Number, Find Duplicate (Floyd's), Merge Sorted Arrays, Sliding Window Maximum, Subarray with Sum, Longest Subarray Sum K, Prefix Sum, Product Except Self, Trapping Rain Water, Container With Most Water, Next Permutation, Search Rotated Array, Majority Element (Boyer-Moore), Stock Buy Sell

✅ 02. Strings (16 Algorithms)

Palindrome Check, Anagram Check, Reverse String, Reverse Words, Longest Palindromic Substring, KMP Pattern Matching, Rabin-Karp, Z Algorithm, Longest Common Prefix, String to Integer (atoi), Group Anagrams, Valid Parentheses, Longest Substring Without Repeating, Count and Say, Remove Duplicates, String Permutations

✅ 03. Linked Lists (7 Operations)

Insert at Head, Reverse Linked List, Detect Cycle (Floyd's), Find Middle, Merge Two Sorted Lists, Remove Nth from End, Palindrome Check

✅ 04. Stacks (5 Problems)

Valid Parentheses, Next Greater Element, Min Stack (O(1) getMin), Evaluate Postfix Expression, Largest Rectangle in Histogram

✅ 05. Queues (6 Problems)

Circular Queue, Queue Using Stacks, First Non-Repeating Character, Sliding Window Maximum, Reverse Queue, Generate Binary Numbers

✅ 06. Recursion (9 Problems)

Factorial, Fibonacci, Power (Fast Exponentiation), Generate Subsets, Generate Permutations, Tower of Hanoi, N-Queens Problem, Solve N-Queens, Combination Sum

✅ 07. Sorting (7 Algorithms)

Bubble Sort O(n²), Selection Sort O(n²), Insertion Sort O(n²), Merge Sort O(n log n), Quick Sort O(n log n), Heap Sort O(n log n), Counting Sort

✅ 08. Searching (8 Variants)

Linear Search, Binary Search (Iterative), Binary Search (Recursive), First Occurrence, Last Occurrence, Search in Rotated Array, Find Peak Element, Square Root (Binary Search)

✅ 09. Hashing (6 Problems)

Two Sum, Subarray with Sum 0, Longest Subarray with Sum K, Count Distinct Elements, First Repeating Element, Group Anagrams

✅ 10. Trees (10 Operations)

Inorder Traversal, Preorder Traversal, Postorder Traversal, Level Order Traversal (BFS), Height of Tree, Diameter of Tree, Lowest Common Ancestor (LCA), Check if Balanced, Mirror Tree, Path Sum

✅ 11. Binary Search Trees (8 Operations)

Insert Node, Search Node, Delete Node, Find Min Value, Validate BST, Kth Smallest Element, LCA in BST, Sorted Array to BST

✅ 12. Heaps (5 Problems)

Min Heap Implementation, Max Heap (priority_queue), Kth Largest Element, Merge K Sorted Arrays, Find Median from Stream

✅ 13. Graphs (13 Algorithms)

DFS (Depth-First Search), BFS (Breadth-First Search), Cycle Detection (Directed), Topological Sort, Dijkstra's Shortest Path, Bellman-Ford Algorithm, Floyd-Warshall (All Pairs), Prim's MST, Kruskal's MST, Tarjan's SCC, Find Bridges, Articulation Points, Bipartite Check

✅ 14. Dynamic Programming (20 Problems)

Fibonacci (Memoization), 0/1 Knapsack, Unbounded Knapsack, Longest Common Subsequence (LCS), Longest Common Substring, Longest Increasing Subsequence (LIS), Longest Palindromic Subsequence, Edit Distance (Levenshtein), Matrix Chain Multiplication (MCM), Coin Change - Min Coins, Coin Change - Ways, Subset Sum, Partition Equal Subset, Rod Cutting, Egg Dropping, Palindrome Partitioning (Min Cuts), Climbing Stairs, House Robber, Minimum Path Sum (Grid), Unique Paths (Grid)

✅ 15. Greedy Algorithms (5 Problems)

Activity Selection, Fractional Knapsack, Minimum Coins (Greedy), Job Sequencing, Minimum Platforms

✅ 16. Backtracking (5 Problems)

Sudoku Solver, Rat in Maze, Generate Parentheses, Word Search, Graph Coloring

✅ 17. Tries (5 Operations)

Insert Word, Search Word, Starts With (Prefix), Delete Word, Longest Common Prefix

✅ 18. Advanced Trees (2 Implementations)

Red-Black Tree (Insert with rotations), AVL Tree (Insert with balancing)

✅ 19. Bit Manipulation (16 Algorithms)

Check if Bit is Set, Set Bit, Clear Bit, Toggle Bit, Check Power of 2, Count Set Bits (Brian Kernighan's), Find Single Number (XOR), Two Single Numbers, Reverse Bits, Swap Without Temp, Find Missing Number (XOR), Generate All Subsets, Maximum XOR of Two Numbers, Count Bits from 0 to n, Add Binary Strings, Divide Using Bit Manipulation

✅ 20. Divide and Conquer (10 Algorithms)

Merge Sort, Quick Sort, Binary Search (Recursive), Maximum Subarray (D&C), Count Inversions, Closest Pair of Points, Strassen's Matrix Multiplication, Karatsuba Multiplication, Median of Two Sorted Arrays, Kth Smallest Element

✅ 21. Segment Trees (3 Implementations)

Range Sum Query, Range Min/Max Query, Lazy Propagation (Range Updates)

✅ 22. Disjoint Set Union (5 Problems)

DSU with Path Compression, Kruskal's MST using DSU, Cycle Detection, Count Connected Components, Friend Circles

✅ 23. Math Algorithms (15 Algorithms)

GCD (Euclidean), LCM, Prime Check, Sieve of Eratosthenes, Prime Factorization, Modular Exponentiation, Modular Inverse, nCr (Combinations), Fibonacci (Matrix Exponentiation), Catalan Numbers, Extended GCD, Count Divisors, Sum of Divisors, Euler's Totient Function, Fast Multiplication (Karatsuba)


📁 Folder Structure

Each topic folder contains:

  • README.md - Concepts, theory, time/space complexity, important problems
  • Code file (.cpp) - Clean, minimal implementations of all algorithms
DSA notes/
├── 01_Arrays/
│   ├── arrays.cpp
│   └── README.md
├── 02_Strings/
│   ├── strings.cpp
│   └── README.md
├── ... (21 more topics)
└── README.md (this file)

🎯 How to Use

  1. Navigate to any topic folder (e.g., 01_Arrays/)
  2. Read README.md for theory, complexity analysis, and problem patterns
  3. Study the .cpp file for implementations
  4. Practice problems mentioned in each README
  5. Implement yourself before checking solutions

📖 Recommended Study Order

Phase 1: Beginner (Weeks 1-4)

→ Arrays → Strings → Linked Lists → Stacks → Queues

Focus: Basic data structures, two pointers, sliding window

Phase 2: Intermediate (Weeks 5-8)

→ Recursion → Sorting → Searching → Hashing → Trees → BST

Focus: Recursion patterns, sorting algorithms, tree traversals

Phase 3: Advanced (Weeks 9-12)

→ Heaps → Graphs → Dynamic Programming → Greedy → Backtracking

Focus: Graph algorithms, DP patterns, optimization techniques

Phase 4: Expert (Weeks 13-16)

→ Tries → Advanced Trees → Bit Manipulation → Divide & Conquer → Segment Trees → DSU → Math Algorithms

Focus: Advanced data structures, competitive programming


🚀 Quick Complexity Reference

Data Structure/Algorithm Time Complexity Space Complexity
Array Access O(1) O(1)
Binary Search O(log n) O(1)
Merge/Quick Sort O(n log n) O(n) / O(log n)
Hash Table Insert/Search O(1) avg O(n)
BFS/DFS O(V+E) O(V)
Dijkstra O((V+E) log V) O(V)
Dynamic Programming O(n²) typical O(n) to O(n²)
Segment Tree Query O(log n) O(n)
DSU Find/Union O(α(n)) ≈ O(1) O(n)

💡 Learning Tips

Understand patterns, not just memorize code ✅ Practice complexity analysis for every algorithm ✅ Implement yourself before checking solutions ✅ Solve variations of each problem ✅ Focus on problem-solving approach over syntax ✅ Review regularly - spaced repetition works ✅ Time yourself when practicing


🎓 Perfect For

  • ✅ 2nd Year Engineering DSA Course
  • ✅ DAA (Design & Analysis of Algorithms)
  • ✅ Competitive Programming (Codeforces, CodeChef, LeetCode)
  • ✅ Interview Preparation (FAANG, Product Companies)
  • ✅ College Exams & Placements

📊 Coverage Summary

  • Total Topics: 23
  • Total Algorithms: 200+
  • Lines of Code: 5000+
  • Coverage: Basic → Advanced → Competitive Programming
  • Language: C++ (STL optimized)

🏆 Interview Focus - Top 50 Must-Know

Arrays: Kadane's, Two Sum, Trapping Water, Stock Buy Sell
Strings: KMP, Longest Palindrome, Valid Parentheses
Linked List: Reverse, Cycle Detection, Merge
Trees: All Traversals, LCA, Diameter, Validate BST
Graphs: DFS, BFS, Dijkstra, Topological Sort
DP: 0/1 Knapsack, LCS, LIS, MCM, Coin Change, Edit Distance
Backtracking: N-Queens, Sudoku
Advanced: Segment Trees, DSU, Bit Manipulation


🌟 Company-Wise Focus

Google: DP, Graphs, Trees, Math
Amazon: Arrays, Strings, DP, Trees
Microsoft: Trees, Graphs, DP, Recursion
Facebook/Meta: Graphs, DP, Backtracking
Competitive Programming: All topics, especially Math, Bit Manipulation, Segment Trees


All implementations are minimal, efficient, and interview-ready! Good luck with your DSA journey! 🚀🎓

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages