Knuth's bounds are both allowed
transcript
Knuth's trick limits the splits. It turns n cubed into n squared. One bound is easy to get wrong.
Each range has a lower and an upper bound. They come from the two shorter ranges. Both bounds are allowed splits.
An exclusive bound looks natural. But equal bounds then try no split. The cost stays at the start value. Include the upper bound.
The plain table needs 562,499,750 triples. Knuth needs about 2,229,682 steps. The answers are equal.
Keep the plain table as a reference. Try a thousand small random inputs. The bug above fails at the first seed.
Ledger shards merge two neighbours at a time. Each merge costs the total size of both. The best split of a range sits between two known splits. That is exactly where the bounds come from. Both ends of that range are allowed.
Both bounds are allowed splits. Test against the plain table. Full breakdown in the lecture.