Skip to content
Tech News
← Back to articles

A simple clustering algorithm for lists

read original more articles
Why This Matters

This article introduces a novel, human-inspired clustering algorithm that uses list reversals to group similar elements, inspired by patterns observed in everyday sorting activities. Its simplicity and heuristic approach make it accessible for practical applications in data organization and pattern recognition, offering a fresh perspective beyond traditional sorting methods. This innovation could influence future algorithm designs, especially in scenarios requiring intuitive and flexible data grouping.

Key Takeaways

May 24, 2026

I’ve been experimenting with a human-friendly way to cluster list values using reversals of sub-lists. Or, in normal human words: I was playing with my toddler’s Magna-Tiles and got into a pattern with how I was sorting and grouping them, and turned it into a little… algorithm? Heuristic? Anyway, look!

Here’s a video I made for reference:

But if you prefer words over video: Let’s say you have a list where node values can be b , g , o , or r .

Initial state: bgogbrbroorrgbgorrbggo

What you do is you take the value that’s at the end (in this case o ), and you find the next value closest to the end with that same value, and you reverse the sub-list between them. So, the next iteration would be:

bgogbrbroorrgbgooggbrr ▲ ▲ └──┬─┘ this part was reversed

We reversed everything to the right of the second o from the right.

And then, you do the same thing, now that r group is at the end, you reverse the sub-list to the next r :

bgogbrbroorrrrbggoogbg ▲ ▲ └────┬───┘ this part was reversed

... continue reading