Data Structures
Data Structures
Section titled “Data Structures”Welcome to the Data Structures & Algorithms section. This module covers fundamental data structures, algorithm analysis, JavaScript-specific implementations, and interview preparation.
📐 Fundamentals
Section titled “📐 Fundamentals”Core algorithm analysis concepts and complexity theory.
- Algorithm Basics
- Time Complexity
- Big-O Notation
- Space Complexity
- Data Structures & Algorithms Handbook
📦 Arrays
Section titled “📦 Arrays”Linear data structures and their operations.
Array Methods (JavaScript)
Section titled “Array Methods (JavaScript)”- Transformation Methods
- Extract / Copy Methods
- Modify (Mutating) Methods
- Search / Check Methods
- Utility Methods
- JS Array Methods (Interview Ready)
📝 Strings
Section titled “📝 Strings”String manipulation, pattern matching, and common string interview problems.
- String Basics — Immutability, char codes, common operations
- Two Pointer Strings — Palindrome, reverse, valid anagram
- Pattern Matching — Naive search, KMP, Rabin-Karp
- String Problems — Anagrams, longest substring, compression
🔢 Matrix (2D Arrays)
Section titled “🔢 Matrix (2D Arrays)”Grid traversal patterns and common matrix problems.
- Matrix Traversals — Row/column, diagonal, spiral
- Matrix Problems — Rotate, spiral, set zeroes, search
📚 Stacks & Queues
Section titled “📚 Stacks & Queues”- Stack (LIFO) — LIFO concept & operations
- Queue (FIFO) — FIFO concept & operations
- Stack Implementation — Array vs linked list
- Queue Implementation — Array, linked list, circular queue
- Deque — Double-ended queue
- Priority Queue & Heap — Tree + array view
- Monotonic Stack — Next greater/smaller element
- Stack & Queue Problems — Valid parentheses, min stack, RPN
🔑 Hashing
Section titled “🔑 Hashing”- Hash, HashMap & Set in JavaScript
- What is a Hash?
- HashMap in JavaScript
- When to Use Map vs Object
- Set in JavaScript
- Map vs Set Quick Difference
🔗 Linked List
Section titled “🔗 Linked List”- Linked List Overview
- Introduction — Definition, analogy, arrays vs linked lists
- Types — Singly, Doubly, Circular
- Complexity — Time & space analysis
- Core Operations — Insert, delete, traverse, search
- Patterns — Fast & slow pointer, reversal, cycle detection
- Algorithms — Code: reverse, merge, palindrome
- Problem Solving — Approach & edge cases
- Interview Questions — LeetCode by difficulty
- Tips & Mistakes — Expert advice & cheat sheet
🌳 Trees
Section titled “🌳 Trees”- Trees Overview
- Introduction — Definition, terminologies, properties
- Types — Binary, BST, AVL, Red-Black, Full/Complete/Perfect
- Special Trees — Trie, Heap, Segment Tree links
- Representation — Pointer-based & array-based
- Complexity — Time & space analysis
- Traversals — DFS (Inorder/Preorder/Postorder) & BFS
- Patterns — LCA, path sum, diameter, balanced check
- BST Operations — Search, Insert, Delete
- Heap Operations — Insert, Delete, Heapify
- Problem Solving — DFS vs BFS, recursive patterns
- Code Examples — Full implementations in JS
- Interview Questions — LeetCode by difficulty
- Tips & Mistakes — Expert advice & edge cases
- Real-World Apps — File systems, databases, autocomplete
Advanced Trees (Dedicated Pages)
Section titled “Advanced Trees (Dedicated Pages)”- Trie (Prefix Tree) — String storage, autocomplete
- AVL Tree — Self-balancing BST
- Red-Black Tree — Concept & comparison
- Segment Tree — Range queries
- Fenwick Tree (BIT) — Prefix sums
📊 Graphs
Section titled “📊 Graphs”- Graphs Overview
- Introduction — Definition, terminologies, types of graphs
- Representations — Adjacency matrix, list, edge list
- Complexity — Time & space analysis by representation
- Traversals (BFS & DFS) — Breadth-First & Depth-First Search
- Patterns — Shortest path, components, cycles, topo sort, union-find
- Algorithms — Overview with links to dedicated pages
Dedicated Algorithm Pages
Section titled “Dedicated Algorithm Pages”-
Dijkstra’s Algorithm — Shortest path (non-negative weights)
-
Bellman-Ford — Handles negative weights
-
Floyd-Warshall — All-pairs shortest path
-
Topological Sort — DAG ordering
-
Union-Find (DSU) — Connected components
-
MST (Kruskal & Prim) — Minimum spanning tree
-
Cycle Detection — Directed & undirected
-
Problem Solving — Decision framework & identification guide
-
Code Examples — Full implementations in JavaScript
-
Interview Questions — LeetCode Easy/Medium/Hard
-
Tips & Mistakes — Expert advice, optimization, cheat sheet
-
Real-World Apps — Networks, maps, social media, games
🔄 Recursion & Backtracking
Section titled “🔄 Recursion & Backtracking”- Recursion Overview
- Introduction — Definition, base case & recursive case, anatomy
- Call Stack — How recursion uses the call stack visually
- Types of Recursion — Tail, head, tree, indirect, mutual recursion
- Basic Problems — Factorial, Fibonacci, power, GCD, string reversal
- Patterns — Subsequences, subsets, permutations, combinations
- Backtracking Intro — Explore-decide-undo template, pruning
- Backtracking Patterns — N-Queens, Sudoku, rat in a maze
- Advanced Backtracking — Word search, graph coloring, combination sum
- Problem Solving — Decision framework, top-down vs bottom-up
- Complexity Analysis — Time & space, recurrence relations, Master Theorem
- Code Examples — Full implementations in JavaScript
- Interview Questions — LeetCode by difficulty
- Common Mistakes — Infinite recursion, stack overflow, debugging
- Real-World Apps — File systems, parsing, AI, fractals
📊 Sorting
Section titled “📊 Sorting”- Sorting Overview
- Introduction — Comparison-based vs non-comparison
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Complexity Comparison
- Interview Questions
Non-Comparison Sorts
Section titled “Non-Comparison Sorts”- Counting Sort — Frequency counting, O(N+K)
- Radix Sort — Digit-by-digit sort
- Bucket Sort — Distribution sort
- Stability & Choosing a Sort — When to use each
💡 Greedy
Section titled “💡 Greedy”- Greedy Introduction — Local best → global best
- Classic Greedy Problems — Activity selection, jump game, gas station
- Huffman Coding — Building the Huffman tree
🔢 Bit Manipulation
Section titled “🔢 Bit Manipulation”- Bit Basics — AND, OR, XOR, NOT, shifts
- Bit Tricks — Set/clear/toggle, mask,
n & (n-1) - Bit Problems — Single number, count bits, subsets
🧮 Math
Section titled “🧮 Math”- GCD, LCM & Euclid’s Algorithm — Remainder-based GCD
- Primes & Sieve of Eratosthenes — Primality test, prime sieve
- Modular Arithmetic & Fast Power — Mod rules, fast exponentiation
- Math Problems — Power of two, factorial, digit problems
🎯 Interview Prep
Section titled “🎯 Interview Prep”- Interview Prep Overview
- Array Methods (Quick Reference) — Map, filter, reduce, slice, splice & more
- Map & Set Patterns — Frequency counter, complement lookup, deduplication
- Two Pointer Technique — Pair problems, in-place reversal, partitioning
- Sliding Window — Fixed & variable window, substring problems
- Frequency Counter Pattern — Counting, anagram check, element comparison
- Recursion & Backtracking Review — Quick review & practice
- Coding Problems — Two Sum, anagrams, intersection & more
- Pro Tips — When to use Map vs Set, common pitfalls
- Study Plan & Cheat Sheet — Prioritized topics & learning path
More Patterns
Section titled “More Patterns”- Prefix Sum — Range sum queries in O(1)
- Fast & Slow Pointers — Cycle detection, find middle
- Merge Intervals — Overlapping interval problems
- Top K Elements (Heap) — Kth largest, frequent elements
- Monotonic Stack — Next greater/smaller element
- Greedy Patterns — When greedy works, classic examples