Hacker News with Generative AI: Algorithms

Dividing an array into fair sized chunks (lemire.me)
Suppose that you have an array of N elements and you want to divide it into M chunks. It is a common task when trying to spread N units of work over M threads, for example.
What3Words – The Algorithm (cybergibbons.com)
What3Words is a widely promoted system that is used for sharing a location using just three words.
For algorithms, a little memory outweighs a lot of time (quantamagazine.org)
One computer scientist’s “stunning” proof is the first progress in 50 years on one of the most famous questions in computer science.
Everyone gets bidirectional BFS wrong (2024) (zdimension.fr)
People really need to stop blindly copying code from the Internet.
Collaborative Text Editing Without CRDTs or OT (mattweidner.com)
Collaborative text editing is arguably the hardest feature to implement in a collaborative app. Even if you use a central server and a fully general solution to optimistic local updates (server reconciliation), text editing in particular requires fancy algorithms - specifically, the core of a text-editing CRDT or OT.
An Almost Pointless Exercise in GPU Optimization (speechmatics.com)
Not everyone is able to write funky fused operators to make ML models run faster on GPUs using clever quantisation tricks. However lots of developers work with algorithms that feel like they should be able to leverage the thousands of cores in a GPU to run faster than using the dozens of cores on a server CPU. To see what is possible and what is involved, I revisited the first problem I ever considered trying to accelerate with a GPU.
A shower thought turned into a Collatz visualization (abstractnonsense.com)
I recently went on a nice long SCUBA diving trip with my wife and daughters. Lots of diving implies lots of showers, and lots of showers means lots of shower-thoughts! [1] An especially interesting one I had turned into a nice way to visualize some aspects of the Collatz Conjecture.
A Zero-Level Set Preserving Technique for SDF Computation (jcgt.org)
Optimal bounds for open addressed hash tables without reordering (arxiv.org)
In this paper, we revisit one of the simplest problems in data structures: the task of inserting elements into an open-addressed hash table so that elements can later be retrieved with as few probes as possible.
Climbing trees 1: what are decision trees? (mathpn.com)
X X^t can be faster (arxiv.org)
We present a new algorithm RXTX that computes product of matrix by its transpose $XX^{t}$. RXTX uses $5\%$ less multiplications and additions than State-of-the-Art and achieves accelerations even for small sizes of matrix $X$. The algorithm was discovered by combining Machine Learning-based search methods with Combinatorial Optimization.
Solving the local optima problem – NQueens (github.com/Dpbm)
You can’t perform that action at this time.
My husband was laid off from Microsoft by an algorithm – after 25 years (reddit.com)
My husband has worked for Microsoft for 25 years. He was just laid off — randomly selected by a computer algorithm. His last day is this Friday — his 48th birthday.
A leap year check in three instructions (hueffner.de)
With the following code, we can check whether a year 0 ≤ y ≤ 102499 is a leap year with only about 3 CPU instructions:
Wavelet Trees: An Introduction (2011) (alexbowe.com)
Today I will talk about an elegant way of answering rank queries on sequences over larger alphabets – a structure called the Wavelet Tree.
Pathfinding (itch.io)
Hello! I've recently been working on the pathfinding for NPCs in my game, which is something I've been looking forward to for a while now since it's a nice chunky problem to solve. I thought I'd write up this post about how I went about it all.
AlphaEvolve: A Gemini-powered coding agent for designing advanced algorithms (deepmind.google)
New AI agent evolves algorithms for math and practical applications in computing by combining the creativity of large language models with automated evaluators
New high-quality hash measures 71GB/s on M4 (github.com/Nicoshev)
rapidhash is wyhash' official successor, with improved speed, quality and compatibility.
The Fastest Way yet to Color Graphs (quantamagazine.org)
Researchers have devised a scheme for painting the edges of a graph that’s almost as speedy as possible.
Show HN: Slice-tree – A piece table data structure implemented using RB tree (github.com/eu-ge-ne)
In computing, a piece table is a data structure typically used to represent a text document while it is edited in a text editor.
Sierpiński Triangle? In My Bitwise and? (lcamtuf.substack.com)
I’m an ethusiastic promoter of the C language. One of the outmoded cultural phenomena associated with C are bit-twiddling hacks: a collection of brain-teasers that implement improbably complex algorithms using bitwise arithmetic. They are often developed under the guise of code optimization, but they mostly serve to impress your friends and confuse enemies.
Engineering Design Optimization Textbook (mdobook.github.io)
A graduate-level textbook covering a range of fundamental to advanced optimization theory and algorithms with practical tips, numerous illustrations, and engineering examples.
Reservoir Sampling (samwho.dev)
Reservoir sampling is a technique for selecting a fair random sample when you don't know the size of the set you're sampling from.
SDFs and the Fast sweeping algorithm in Jax (rohangautam.github.io)
This is going to be a fun blog - we'll explore the intuition behind level sets, the Eikonal equation, and implement a speedy algorithm for solving this equation, called the fast sweeping method, in JAX.
The Design of Compact Elastic Binary Trees (Cebtree) (blogspot.com)
Those who often hear me discuss about my week-end projects have been accustomed to hearing about deuterium fusion (that's for another post), laser engraving, and the compact version of the ebtrees, aka compact elastic binary trees, without knowing all the details. That's what we'll be discussing here.
Time Between The Lines: how memory access affects performance (2015) (bitbashing.io)
As programmers, one of our main jobs is to reason about algorithms and put them to use.
Adaptive Hashing (quotenil.com)
At the 2024 ELS, I gave a talk on adaptive hashing, which focusses on making general purpose hash tables faster and more robust at the same time.
Bloom Filters (thegreenplace.net)
The original motivation for the creation of Bloom filters is efficient set membership, using a probabilistic approach to significantly reduce the time and space required to reject items that are not members in a certain set.
Ask HN: Resources for LeetCode Grinding? (ycombinator.com)
Looking to spend 6 months or so, with focus on prep for interviews.
Generating Mazes with Inductive Graphs (2017) (jelv.is)
A few years ago—back in high school—I spent a little while writing programs to automatically generate mazes. It was a fun exercise and helped me come to grips with recursion: the first time I implemented it (in Java), I couldn’t get the recursive version to work properly so ended up using a while loop with an explicit stack!