Skip to main content
  1. Home
  2. Emerging Tech
  3. Computing
  4. Smart Home
  5. News

The ultimate sorting algorithm for alphabetizing your books efficiently

Add as a preferred source on Google

We’re suckers for the kind of “life hacks” that tell you that you’ve been doing some relatively mundane task all wrong, and that there’s a super-easy alternative which can massively speed up your ability to perform it.

That’s what a new video from the TED-Ed YouTube channel does, by showing how different sorting algorithms can transform our ability to quickly alphabetize a large number of books on a bookshelf.

Recommended Videos

The video starts by describing two common sorting algorithms; “bubble sort” and “insertion sort.” In the former, a sorting algorithm repeatedly steps through a list that needs to be sorted, compares each pair of adjacent items in turn, and then swaps them over if they happen to be in the wrong order. In the latter, new items are constantly “inserted” into previous sublists for an ever-growing search pile.

Both will work for this problem, but are less than efficient if time is of the essence.

The optimal answer, it turns out, is something called “quicksort,” which is regularly used by programmers for a variety of different applications — from sorting items by price to showing you the closest gas station on a GPS map.

To sort your pile of books the quicksort way, begin by taking a book from roughly the middle of the shelf. This becomes your “partition” book, and by sorting everything on its left and right into books which come either before or after it, you instantly reduce the total number of items to search against in sub-piles.

Once this is done, you then add partition books to the middle section of the two smaller piles, and then keep doing this until you have multiple partition books and a bunch of manageable piles to sort. After that, switch to a sorting algorithm like “insertion sort” to get them properly alphabetized.

Simple, right? Sure, it’s a pretty basic bit of computer science translated into the real world, but we bet that you’ll never think about alphabetizing in quite the same way again.

Now if we could only stop spending hours watching such “life hack” videos, we might actually get something done a bit more efficiently around here!

Luke Dormehl
I'm a UK-based tech writer covering Cool Tech at Digital Trends. I've also written for Fast Company, Wired, the Guardian…
Meta’s Brain2Qwerty v2 turns thoughts into text, and it doesn’t need brain implants
The latest AI model decodes brain signals into coherent sentences using external scanners.
Meta Brain2Qwerty v2 Featured

Artificial intelligence is getting surprisingly good at understanding humans. Now, Meta wants it to understand our brains too. The company has unveiled Brain2Qwerty v2, an upgraded AI system that can translate brain activity into full sentences, all without requiring brain implants or surgery. The goal isn't mind reading for the masses. Instead, it's to help people who have lost the ability to speak communicate again.

How a Brain-powered keyboard works

Read more
AI chatbots can often feed into your delusions. Researchers say you should look for three signs
Experts warn that chatbot design choices can reinforce unhealthy beliefs in vulnerable users.
ChatGPT on a smartphone

Artificial intelligence chatbots have become incredibly good at sounding human. But a new review paper by psychiatrist Marc Augustin and fellow researchers Thomas A. Pollak and Helen Morrin, published in NPP—Digital Psychiatry and Neuroscience, argues that existing AI research points to an overlooked psychological risk. The paper, highlighted by The Wall Street Journal, reviews previous studies and proposes a framework explaining how three common chatbot behaviors can combine to reinforce delusional thinking in vulnerable users, creating what the authors call an "amplification spiral."

Researchers say these are the three warning signs

Read more
Lost access to your crypto wallet? Don’t Google your way out of it
Security researchers warn that fake recovery tools are becoming the latest trap for crypto owners.
Bitcoin crypto wallet featured

Forgetting the recovery phrase to a crypto wallet can be stressful enough. Unfortunately, that's exactly the moment scammers are waiting for. A new warning highlights a growing scam in which cybercriminals disguise malware as cryptocurrency recovery software, tricking desperate users into handing over far more than just access to their wallets.

The fake recovery tool that's actually malware

Read more