Found in 1 comment on Hacker News
SavantIdiot · 2021-10-16 · Original thread
Similarly, Robert Sedgewick covered this in his 1990's book "Algorithms in C" quite nicely, and a bit more succinctly, IMO.

https://www.amazon.com/Algorithms-Computer-Science-Robert-Se...