SortPedia

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
Bogo Sort
Bogobogo Sort
Bozo Sort
Bubble Sort
Cocktail Sort
Comb Sort
Counting Sort
Cycle Sort
Gnome Sort
Heap Sort
Insertion Sort
Intelligent Design Sort
Intro Sort
Merge Sort
Miracle Sort
Odd-Even Sort
Pancake Sort
Patience Sort
Quantum Bogo Sort
Quick Sort
Radix Sort
Selection Sort
Shell Sort
Slow Sort
Smooth Sort
Stalin Sort
Stooge Sort
Strand Sort
Thanos Sort
Tree Sort

Top categories

Loading Svelte Themes