Randomized Quicksort, 15 Languages
CSC 482 — Homework 3: language comparison. Same algorithm
(CLRS's RANDOMIZED-QUICKSORT), same timing protocol, one
implementation per language, benchmarked on the same machine.
At a glance
Every language ran the same in-place, randomly-pivoted quicksort,
doubling n each iteration starting at 1,000, until a single
iteration exceeded 4.0 seconds. Fastest to slowest at the largest shared
n each language reached:
| Language | Max n reached | Time at max n |
|---|---|---|
| C++ | 65,536,000 | 5.45 s |
| C | 65,536,000 | 5.59 s |
| Zig | 65,536,000 | 5.59 s |
| Assembly | 65,536,000 | 5.95 s |
| Rust | 65,536,000 | 5.88 s |
| F# | 65,536,000 | 5.87 s |
| Go | 65,536,000 | 6.71 s |
| C# | 65,536,000 | 6.44 s |
| Java | 65,536,000 | 7.81 s |
| Common Lisp | 65,536,000 | 8.80 s |
| Pascal | 65,536,000 | 9.29 s |
| PHP | 8,192,000 | 8.24 s |
| TypeScript | 32,768,000 | 4.04 s |
| Python | 2,048,000 | 5.00 s |
| JavaScript | 65,536,000 | 13.36 s |
Full discussion, anomalies (JIT warmup, GC pauses, a JavaScript large-n outlier), and CPU details are in the results & comparison page.
Explore
Methodology
The shared experiment protocol every language followed — algorithm, timing harness, stopping conditions, environment.
Results & Comparison
Compliance check against the assignment, full results, plots, and the cross-language discussion.
Language Reports
One detailed report per language: version, RNG/pivot method, citations, full data table.
Source Code
The actual randomized quicksort implementation in each of the 15 languages.