Sorting Tournament Ep.001 — 16 Algorithms, 4 Rounds, One Champion (n=128 · scratch memory ≤ n)
Loopulse
0:00 / 0:00
Sorting Tournament Ep.001 — 16 Algorithms, 4 Rounds, One Champion (n=128 · scratch memory ≤ n)
462 просмотра · 1 мес. назад
Loopulse
286 подписчиков
462 просмотра · 1 мес. назад
"So, what is the final winner?" — you asked, so here is the bracket.
「結局どれが一番速いの?」というコメントに答えるトーナメント編です。
16 sorting algorithms, one representative per family, race on the same array at the same speed. Four rounds change the input: random, reversed, sorted with a 10% random tail, and an array full of duplicates.
族ごとの代表16本が、同じ配列・同じ速度で走ります。4ラウンドで入力を変えます:ランダム/逆順/末尾10%だけ乱数/重複だらけ。
Cost model: every read or write of memory is 1 tick, scratch memory included. Comparisons are free. This is memory traffic, not wall-clock time — no cache, no branch prediction.
数え方:メモリの読み書き1回=1 tick(作業メモリ込み)。比較は0。実時間ではなくメモリ往復の回数で競います。キャッシュや分岐予測はありません。
Scoring: rank by ticks in each round (1st = 1 pt … 16th = 16 pt). Lowest total after four rounds is the champion. Heats are for watching; the ranking uses every algorithm's ticks.
採点:ラウンドごとに tick の少ない順で1〜16点。4ラウンド合計が少ない方が優勝。組分けは見せ方で、順位は16本全員の tick で決まります。
This episode: n = 128, values are a permutation of 1..128 (Round 4 has duplicates), scratch memory up to n. Distribution sorts (Counting, Radix, American Flag) exploit the value range — allowed here. Change n, the range or the memory budget and the champion changes: the in-place-only and wide-range episodes are next.
この回の条件:n = 128、値は1〜128の並べ替え(第4ラウンドだけ重複あり)、作業メモリは n まで。分布系(Counting・Radix・American Flag)は値域を利用します(この回のルール内)。n・値域・メモリを変えると王者が変わるので、メモリ小級・値域を広げた回を続けて出します。
Contenders: Bubble / Comb / Quick (Hoare) / Quick (3-way) / Merge / Tim / In-place Merge / Insertion / Shell / Selection / Heap / Cycle / Counting / Radix LSD (base16) / American Flag / Bitonic. Close cousins (Cocktail, Gnome, Lomuto, Bucket, Flash…) sit this one out; Bogo and Stooge never finish.
出場:上記16本。近い亜種(Cocktail・Gnome・Lomuto・Bucket・Flash…)は出しません。Bogo・Stooge は終わらないので不参加です。
4 rounds | 16 algorithms | 20 races | 4K
4ラウンド | 16アルゴリズム | 20レース | 4K
Every write has a sound. No talking, no cuts.
全ての書き込みに音がつきます。ナレーションもカットもありません。
🎵 Math algorithms implemented in Python to generate visuals and audio
#sorting #algorithm #satisfying #programming
0:00 Rules & Conditions
0:15 Round 1 · Heat 1 — Random
0:47 Round 1 · Heat 2 — Random
1:19 Round 1 · Heat 3 — Random
1:53 Round 1 · Heat 4 — Random
2:18 Round 1 · Final — Random
2:46 Round 2 · Heat 1 — Reversed
3:20 Round 2 · Heat 2 — Reversed
3:54 Round 2 · Heat 3 — Reversed
4:28 Round 2 · Heat 4 — Reversed
5:03 Round 2 · Final — Reversed
5:29 Round 3 · Heat 1 — Sorted + 10% random tail
6:02 Round 3 · Heat 2 — Sorted + 10% random tail
6:36 Round 3 · Heat 3 — Sorted + 10% random tail
7:08 Round 3 · Heat 4 — Sorted + 10% random tail
7:42 Round 3 · Final — Sorted + 10% random tail
8:10 Round 4 · Heat 1 — Few distinct values
8:44 Round 4 · Heat 2 — Few distinct values
9:16 Round 4 · Heat 3 — Few distinct values
9:51 Round 4 · Heat 4 — Few distinct values
10:16 Round 4 · Final — Few distinct values
10:44 Final Standings