Skip to content

astraen-dev/sortpedia

Repository files navigation

SortPedia

License Svelte TypeScript

SortPedia is a modern, interactive encyclopedia of sorting algorithms. It bridges the gap between abstract computer science theory and intuitive visual understanding.

From industry standards like Quick Sort and Merge Sort to chaotic esoteric algorithms like Thanos Sort and Quantum Bogo Sort, SortPedia lets you watch, race, and benchmark them all.

Features

1. Interactive Visualizer

Watch algorithms process data step-by-step.

  • Control Time: Pause, play, step forward/backward, and adjust speed.
  • Live Metrics: Track comparisons, swaps, and array accesses in real-time.
  • Code Highlighting: See exactly which line of code is executing.

2. Algorithm Racinng

Compare two algorithms side-by-side on identical datasets.

  • Visualize how $O(n^2)$ differs from $O(n \log n)$ visually.
  • Spot differences in stability and access patterns.

3. Performance Benchmarking

Run actual performance tests in your browser.

  • Measure raw execution time (ms) across thousands of iterations.
  • Uses Web Workers to prevent UI freezing during heavy computations.

4. Comprehensive Library

A dedicated wiki for every algorithm.

  • Complexity Analysis: Best, Average, and Worst-case time/space complexity rendered with $\LaTeX$.
  • Deep Dives: Explanations of stability, adaptivity, and in-place sorting.
  • Implementation: Clean, copy-pasteable TypeScript/JavaScript implementations.

Supported Algorithms

SortPedia currently implements 31 algorithms, from industry standards to esoteric jokes. Each is visualized with detailed explanations of its properties. See the full list below.

Tech Stack

  • Framework: SvelteKit (Svelte 5 Runes)
  • Language: TypeScript
  • Styling: TailwindCSS (v4)
  • Math Rendering: KaTeX
  • Architecture:
    • Web Workers: Heavy sorting logic runs off the main thread.
    • Generators: Algorithms are implemented as generator functions to yield exact steps for visualization.

Getting Started

Prerequisites

  • Node.js 20+
  • pnpm (recommended)

Installation

git clone https://github.com/astraen-dev/sortpedia.git
cd sortpedia
pnpm install
pnpm dev --open

Contributing

We welcome new sorting algorithms!

  1. Create a folder in src/lib/algorithms/ with the algorithm name.
  2. Implement data.ts (metadata), index.ts (generator logic), and perf.ts (raw performance logic if bounded worst case).
  3. Open a Pull Request.

License

Distributed under the MIT License. See LICENSE for more information.

Implemented Algorithms

Algorithm Languages
Binary Insertion Sort JavaScript
Bogo Sort JavaScript
Bogobogo Sort TypeScript
Bozo Sort JavaScript
Bubble Sort JavaScript
Cocktail Sort JavaScript
Comb Sort JavaScript
Counting Sort JavaScript
Cycle Sort JavaScript
Gnome Sort JavaScript
Heap Sort JavaScript
Insertion Sort JavaScript
Intelligent Design Sort JavaScript
Intro Sort JavaScript
Merge Sort JavaScript
Miracle Sort JavaScript
Odd-Even Sort JavaScript
Pancake Sort JavaScript
Patience Sort JavaScript
Quantum Bogo Sort JavaScript
Quick Sort JavaScript
Radix Sort JavaScript
Selection Sort JavaScript
Shell Sort JavaScript
Slow Sort JavaScript
Smooth Sort TypeScript
Stalin Sort JavaScript
Stooge Sort JavaScript
Strand Sort JavaScript
Thanos Sort JavaScript
Tree Sort JavaScript

Contributors 2

  •  
  •