Skip to content

Repository files navigation

SortPedia

LicenseSvelteTypeScript

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

  • Bun 1.3+

Installation

git clone https://github.com/astraen-dev/sortpedia.git
cd sortpedia
bun install
bun 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

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

About

A visual encyclopedia of sorting algorithms.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Used by

Contributors

Languages