Comprehensive JavaScript solutions for classic DSA questions combined with a premium interactive web-based visual explorer.
๐ Live Demo: https://dsa-solutions-ten.vercel.app/
Dijkstra's shortest path with live distance table updates
Segment Tree range query with overlap highlighting
Full keyboard shortcut support for hands-free learning
The repository contains a custom web application located in the /visualizer directory. It uses HTML5 Canvas and an interactive step-by-step frame-animation engine to display the mechanics of algorithms in real-time.
Our custom animation engine supports full playback controls:
- Play/Pause (
โธ/โถ): Toggle active playback. - Step Forward (
โญ): Step animation index forward by 1 frame. - Step Backward (
โฎ): Step animation index backward by 1 frame. - Reset (
๐): Resets frame index to0and redraws the initial setup. - Speed Slider: Dynamically divides the frame timeout delay (range:
0.25xto4x).
- Enter: Run the current algorithm with selected inputs.
- Escape:
- If viewing an algorithm runner โ return to the topic detail page.
- If viewing a topic detail page โ return to the home screen.
- Node.js: version 18.0.0 or higher.
- Browser Compatibility: Modern browsers (Chrome 90+, Firefox 88+, Safari 14+, Edge 90+) supporting HTML5 canvas and rounded rectangles.
Run any solution file using Node.js directly:
# Run Graph algorithms
node 12_graphs/graphs.js
# Run Segment Tree algorithms
node 16_segment_tree/segment_tree.jsTo run the interactive visualizer locally:
- Navigate to the
visualizerdirectory:cd visualizer - Spin up a local development web server:
# Python (standard installation) python -m http.server 8080 # Node/NPM (one-click dev server) npx serve .
- Open
http://localhost:8080in your web browser.
๐ก Or skip local setup entirely โ use the live deployment at https://dsa-solutions-ten.vercel.app/
- Master Solutions Index: A complete list of implemented algorithms, complexities, difficulties, and file paths.
- Algorithmic Design Patterns: Solutions categorized by standard design patterns (Two Pointers, Sliding Window, Monotonic Stack, etc.).
- FAANG Company Mapping: Frequent interview questions from Google, Meta, Amazon, and Microsoft mapped to code solutions.
- Complexity Cheat Sheet: Access, search, insert, and delete complexities for all data structures and sorting algorithms.
- Technical Interview Strategy: Whiteboard strategies, dry running procedures, clarification checklists, and time allocation templates.
- System Design Basics & DSA: Bridges data structures (Skip Lists, B-Trees, Tries) to distributed architectures (LSM Trees, Consistent Hashing, LRU Caches).
- 01_basic_math: Primality checks, factorials, digit counting, and basic number logic.
- 02_patterns: Geometric pattern rendering, pyramids, diamonds, checkerboards, and Pascal's Triangle.
- 03_strings: Palindrome checks, anagram validations, reversals, and character frequencies.
- 04_arrays: Sums, min/max values, rotations by K elements, and sorted array merging.
- 05_searching: Linear, binary, and rotated search implementations.
- 06_sorting: Bubble, Selection, Insertion sort, and Dutch National Flag partition.
- 07_recursion: Tower of Hanoi simulation, subsets generation, and recursive math helpers.
- 08_data_structures: Linked Lists (insertion, deletion, middle nodes, reversals) and Array-based Stacks & Queues.
- 09_advanced_patterns: Sliding Window bounds and Two-Pointer paradigms (e.g., 3Sum).
- 10_advanced_misc: Matrix sorting, Catalan numbers, postfix expressions evaluation, and first missing positive.
- 11_trees: DFS Traversals (inorder/preorder/postorder), BFS Traversals (level-order traversal), tree height, BST validation, and mirroring.
- 12_graphs: Adjacency list implementation, BFS, DFS, shortest path in unweighted graphs, and Dijkstra's Algorithm for weighted graphs.
- 13_dynamic_programming: Memoized Fibonacci, 0/1 Knapsack, Longest Common Subsequence (LCS), and Min Coin Change.
- 14_heaps_trie: Min-Heap bubble-up/down logic and Trie (Prefix Tree) inserts/searches.
- 15_bit_manipulation: Bit get/set/clear/update operations, powers of two checks, Hamming Weight (set bits count), and XOR single number.
- 16_segment_tree: Range Sum Query and Point Update segment tree implementation.
- 17_backtracking: N-Queens, Sudoku Solver, and Permutations.
- 18_greedy: Activity Selection, Fractional Knapsack, and Jump Games.
- 19_union_find: DSU class implementation, cycle detection, and Kruskal's Minimum Spanning Tree.
- 20_monotonic_stack: Next Greater Element, Largest Rectangle in Histogram, and Trapping Rain Water using monotonic stack designs.
- blind_75: Highly optimized solutions for standard Blind 75 questions categorized by type (Array, Binary, DP, Graph, etc.).
Contributions are welcome! Please see visualizer/README.md to understand the architecture, state transition flow, and step-by-step instructions on how to add new algorithms or visualizers.
This project is licensed under the MIT License โ see the LICENSE file for details.