This repository contains interactive visualizations of various classic algorithms and data structures. Through animations and interactions, it helps understand the core concepts and working principles of algorithms. Each algorithm comes with detailed documentation and examples for learning and practice.
1. Skip List ⚡
A probabilistic data structure that uses a layered index to accelerate searching.
- Time Complexity: O(log n) average search time
- Features:
- Multi-level fast indexing
- Probabilistic balancing
- Space-time trade-off
- Visualization Features:
- Search path tracking
- Node level display
- Real-time animation
2. Small World Network 🌐
Demonstrates the "six degrees of separation" phenomenon and small-world characteristics.
- Network Features:
- Average path length: O(log n)
- High clustering coefficient
- Core Concepts:
- Regular to small-world network transition
- Random rewiring process
- Network feature quantification
- Interactive Features:
- Dynamic parameter adjustment
- Network property calculation
- Node relationship exploration
Efficient approximate nearest neighbor search algorithm combining small-world networks and multi-level structure.
- Performance:
- Query time: O(log n)
- Build time: O(n log n)
- Space complexity: O(n log n)
- Algorithm Features:
- Multi-level navigation structure
- Greedy routing strategy
- Probabilistic layering
- Visualization Elements:
- Layer structure display
- Search path tracking
- Performance monitoring
4. B+ Tree 🌳
Efficient multi-way search tree widely used in database indexing and file systems.
- Performance:
- Search time: O(log n)
- Insert time: O(log n)
- High space utilization
- Algorithm Features:
- All data stored in leaf nodes
- Leaf nodes form a linked list
- Non-leaf nodes store only indexes
- Visualization Elements:
- Tree structure dynamic display
- Insert operation demonstration
- Search process tracking
High-performance vector similarity search algorithm combining space partition trees with navigable small world graphs.
- Performance:
- Build time: O(n log n)
- Query time: O(log n) average case
- Space complexity: O(n)
- Algorithm Features:
- Hybrid tree-graph structure
- Parallel search paths
- Multi-threading support
- Visualization Elements:
- Space partition visualization
- Graph connectivity display
- Search path tracking
-
Frontend Technologies:
- HTML5 Canvas: Drawing and animation
- Native JavaScript: Algorithm implementation
- CSS3: Layout and styling
-
Project Features:
- No dependencies
- High-performance rendering
- Responsive layout
- Elegant animations
-
Setup
# Clone repository git clone https://github.com/yourusername/algorithm-visualizations.git cd algorithm-visualizations # Start local server python3 -m http.server 8000
-
Access Demos
- Open browser and visit
http://localhost:8000
- Select the algorithm to view
- Follow the README of each algorithm
- Open browser and visit
- Graph Algorithms
- Shortest Path Algorithms
- Minimum Spanning Tree
- Graph Coloring
- Advanced Tree Structures
- Red-Black Tree
- AVL Tree
- Trie
- String Algorithms
- KMP Algorithm
- Suffix Array
- AC Automaton
Contributions of new algorithm implementations or improvements to existing ones are welcome! Please follow these steps:
- Fork this repository
- Create a new branch
git checkout -b feature/algorithm-name
- Commit changes
git commit -m 'Add new algorithm'
- Push to branch
git push origin feature/algorithm-name
- Submit Pull Request
MIT License - See LICENSE file for details