Master Data Structures & Algorithms

1000 curated problems โ€” with 100% verified LeetCode links, interactive code solutions, and a complete beginner-to-advanced educational encyclopedia.

Difficulty:
Status:
Showing 1โ€“50 of 1000 problems
# Problem Title Difficulty Topic & Pattern LeetCode Link Actions

๐Ÿ“š Data Structures & Algorithms โ€” Encyclopedic Educational Guide

A comprehensive, structured reference to master computer science fundamentals, data structures, and algorithmic techniques from beginner level to advanced product-company interview standards.

โšก Module 1: Asymptotic Analysis & Big-O Complexity Matrix

Big-O Time & Space Complexity Reference Matrix

Big-O quantifies upper-bound growth rates relative to input size N. Below is the essential complexity hierarchy:

Notation Name Growth Rate Max N (1 sec) Typical Operations
O(1) Constant Flat โˆž Array index access, Hash Map fetch, Stack push/pop
O(log N) Logarithmic Extremely Slow 10ยนโธ Binary search, Balanced BST lookup, Euclidean GCD
O(N) Linear Proportional 10โท Single array loop, Hash Map building, BFS/DFS traversal
O(N log N) Linearithmic Moderate 10โถ Merge Sort, QuickSort average, HeapSort, Priority Queue operations
O(Nยฒ) Quadratic Fast Growth 10โด Nested loops, Bubble/Insertion Sort, All-pairs distance grid
O(2โฟ) Exponential Explosive 20 Generating all subsets, Naive Fibonacci recursion
O(N!) Factorial Extreme 10 Generating all permutations, Traveling Salesperson brute force

๐ŸŸข Module 2โ€“5: Linear Data Structures & Subarray Techniques

Module 2: Arrays, Strings & Two Pointers

Contiguous memory allocations enabling O(1) index lookups. Master Two Pointers and Sliding Window subsegment mechanics.

  • Two Pointers: Converging pointers (left & right) to solve O(N) Sorted Pair Sums.
  • Sliding Window: Maintaining dynamic window constraints for subsegment metrics.
  • Prefix Sums: Precomputing P[i] = P[i-1] + A[i] for O(1) range queries.

Module 3: Hash Tables & Hash Sets

Key-value mappings translating keys to bucket indices. Delivers average O(1) insertions, lookups, and deletions.

  • Collision Resolution: Chaining (linked lists) vs Open Addressing (linear probing).
  • Frequency Counter Pattern: Checking anagrams, duplicate counts, and complement pairs.
  • LRU Cache Design: Combining Hash Map + Doubly Linked List for O(1) cache evicted updates.

Module 4: Linked Lists & Memory Mechanics

Node pointers allocating data dynamically without requirement for contiguous memory blocks.

  • Fast & Slow Pointers (Floyd's Cycle): Cycle detection and middle node discovery.
  • In-Place Reversal: Reversing next pointers iteratively using prev, curr, next.
  • Dummy Node Technique: Avoiding null head edge case checks when merging lists.

Module 5: Stacks, Monotonic Stacks & Queues

Linear structures enforcing strict LIFO (Last-In-First-Out) and FIFO (First-In-First-Out) access mechanics.

  • Monotonic Stack: Maintaining ordered elements to find Next Greater Element in O(N).
  • Expression Evaluation: Postfix / Reverse Polish Notation calculation.
  • Deques (Double-Ended Queues): O(1) push/pop at both ends for Sliding Window Maximum.

๐ŸŸก Module 6โ€“9: Searching, Sorting, Trees & Heaps

Module 6: Searching & Binary Search Variations

Divide-and-conquer search algorithm halving search space at each iteration (O(log N)).

  • Lower & Upper Bounds: Finding first and last occurrences of target values.
  • Rotated Sorted Array: Evaluating mid boundary conditions relative to target range.
  • Binary Search on Answer Space: Finding minimum capacity or time limit matching target feasibility.

Module 7: Sorting Algorithms & Custom Comparators

Ordering elements according to relational criteria. Inplace vs Stable sorting algorithms.

  • Merge Sort: Divide-and-conquer stable sorting executing in O(N log N) time and O(N) space.
  • QuickSort: Partitioning around pivot element executing in average O(N log N) time.
  • Custom Comparators: Multi-attribute custom sorting lambda functions in C++, Java, Python, JS.

Module 8: Binary Trees, BST & Self-Balancing

Hierarchical tree node structures. Binary Search Trees satisfy Left < Root < Right invariant.

  • Inorder Traversal: Yields sorted element order when traversing BSTs.
  • Tree Height & Diameter: Bottom-up recursive tree postorder calculations.
  • Lowest Common Ancestor (LCA): Identifying branching split point for candidate target nodes.

Module 9: Heaps & Priority Queues

Complete binary trees maintaining Min-Heap or Max-Heap property stored efficiently in arrays.

  • O(N) Heapify: Building valid Heap from unsorted array in linear time.
  • Top K Elements: Maintaining Min-Heap of size K for O(N log K) processing.
  • Two Heaps Pattern: Max-Heap + Min-Heap for real-time streaming median calculations.

๐Ÿ”ด Module 10โ€“15: Tries, Advanced Graphs, DP & Bit Manipulation

Module 10: Tries (Prefix Trees) & Autocomplete

Tree structure designed for character prefix lookup. Delivers O(Length) word operations.

  • Prefix Searching: Finding all words matching candidate string prefix.
  • Word Search II: Trie + Grid DFS Backtracking to find dictionary words.

Module 11 & 12: Graph Shortest Path & DSU

Representations via Adjacency Lists/Matrices modeling networks, components, and weighted distances.

  • BFS Shortest Path: Level-order queue traversal for unweighted graphs.
  • Dijkstra's Algorithm: Weighted single-source shortest path using Priority Queue.
  • Disjoint Set Union (DSU): Path compression + union by rank for O(ฮฑ(N)) connectivity.

Module 13 & 14: Topological Sort & Dynamic Programming

Task dependency resolution and subproblem caching optimization.

  • Topological Sorting: Kahn's BFS Algorithm and DFS Postorder for DAG dependencies.
  • Dynamic Programming (DP): Top-Down Memoization vs Bottom-Up Tabulation.
  • DP Patterns: 0/1 Knapsack, Coin Change, Longest Common Subsequence (LCS), Edit Distance.

Module 15: Backtracking & Bit Manipulation

Decision-tree search and fast bitwise binary computations.

  • Backtracking Template: Recursive choice state, pruning, and backtracking cleanup.
  • Bitwise XOR Tricks: x ^ x = 0 and x ^ 0 = x for single number discovery.
  • Fast Exponentiation: O(log N) modular power calculation.

๐Ÿ“Š Learner Progress Dashboard

Track your overall progress, difficulty distribution, streak history, and smart recommendations.

Total Solved

0 / 1000

Easy Solved

0 / 300

Medium Solved

0 / 500

Hard Solved

0 / 200