Skip to content

Algorithms

This module treats algorithms as executable claims. Every entry below links to runnable code, benchmark evidence, or reproducible experiments in this repository.

Algorithm Map

Sorting

From comparison sorts to SIMD-accelerated radix. Performance is measured, not assumed.

Hashing

Hash functions and hash table layouts that survive cache pressure and concurrent access.

Complexity Quick Reference

AlgorithmTimeSpaceCache FriendlyParallelKey Trade-off
Quicksort (introspective)O(n log n) avgO(log n)PartialHardBranch misprediction on pivot
Merge sortO(n log n)O(n)YesEasyExtra memory for merging
Radix sort (LSD)O(nk)O(n + r)YesModerateKey width and digit size
Robin Hood hashingO(1) expO(n)YesHardRobin Hood shift on insert
Swiss Tables (F14)O(1) expO(n)YesHardSIMD probing, flat layout

What makes an algorithm "high-performance" here

  1. Measurable first. A claim about complexity or throughput must be backed by a benchmark that compiles with the repository's CMake presets.
  2. Cache-aware, not just big-O aware. Constant factors and memory access patterns often dominate asymptotic bounds on real hardware.
  3. ISA-conscious. When vectorization changes the algorithmic approach (e.g., bitonic sort on SIMD, SIMD probing in F14), the implementation is inspected with Compiler Explorer and validated with perf stat.
  4. Maintainability boundary. The repository stops before becoming a production library. Each algorithm is a teaching-sized implementation with explicit trade-off notes, not an exhaustive optimization catalog.

Reading order

  1. Start with Sorting if you want to see how classic algorithms are adapted for modern CPU pipelines.
  2. Continue with Hashing to understand memory layout decisions that affect every hash-heavy workload.
  3. Cross-reference the Performance Methodology page whenever a benchmark claim needs calibration.

Released under the MIT License.