The ultimate sorting algorithm for alphabetizing your books efficiently

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.

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!

Emerging Tech

Awesome Tech You Can’t Buy Yet: Write music with your voice, make homemade cheese

Check out our roundup of the best new crowdfunding projects and product announcements that hit the web this week. You may not be able to buy this stuff yet, but it sure is fun to gawk!
Gaming

These are the must-have games that every Xbox One owner needs

More than four years into its life span, Microsoft's latest console is finally coming into its own. From Cuphead to Halo 5, the best Xbox One games offer something for players of every type.
Gaming

Your PlayStation 4 game library isn't complete without these games

Looking for the best PS4 games out there? Out of the massive crop of titles available, we selected the best you should buy. No matter what your genre of choice may be, there's something here for you.
Computing

Laptop displays are notorious for draining batteries. Intel may have a solution

Intel has leveraged smartphone display technology and a handful of other innovations to create Low Power Display Technology (LPDT) panels that cut display power use in half.
Emerging Tech

Mind-bending model shows Venus isn’t our nearest neighbor — it’s Mercury

Every textbook and table on the internet agrees -- the closest planet to Earth is Venus. But a new mathematical model shows that this is wrong. In fact, the planet closest to us on average is Mercury.
Emerging Tech

Desk lamps take on a new task by converting their light to power

What if we could charge devices using light from indoor sources like desk lamps? A group of scientists working on a technology called organic photovoltaics (OPVs) aim to do just that.
Emerging Tech

A.I.-generated text is supercharging fake news. This is how we fight back

A new A.I. tool is reportedly able to spot passages of text written by algorithm. Here's why similar systems might prove essential in a world of fake news created by smart machines.
Emerging Tech

Body surrogate robot helps people with motor impairments care for themselves

A team from Georgia Tech has come up with an assistant robot to help people who have severe motor impairments to perform tasks like shaving, brushing their hair, or drinking water.
Emerging Tech

New Hubble image displays dazzling Messier 28 globular cluster

Messier 28 is a group of stars in the constellation of Sagittarius, located 18,000 light-years from our planet. Thousands of stars are packed tightly together in this sparkling image.
Emerging Tech

Cosmic dust bunnies: Scientists find unexpected ring around Mercury

A pair of scientists searching for a dust-free region near the Sun have made an unexpected discovery: a vast cosmic dust ring millions of miles wide around the tiny planet Mercury.
Emerging Tech

Take a dip in the Lagoon Nebula in first image from SPECULOOS instrument

The European Southern Observatory has released the first image collected by their new SPECULOOS instrument, and it's a stunning portrait of the Lagoon Nebula, a swirling cloud of dust and gas where new stars are born.
Emerging Tech

Robot assistants from Toyota and Panasonic gear up for the Tokyo Olympics

Japan plans to use the 2020 Olympics to showcase a range of its advanced technologies. Toyota and Panasonic are already getting in on the act, recently unveiling several robotic designs that they intend to deploy at the event.
Emerging Tech

Racing to catch a flight? Robot valet at French airport will park your car

Hate searching for parking at the airport when you need to catch a plane? Startup Stanley Robotics recently unveiled a new outdoor automated robotic valet system. Here's how it works.
Business

Bags with brains: Smart luggage and gadgets are making travel smoother

The bag you use to tote your stuff can affect the experience of any trip. In response, suitcases are wising up, and there are now options for smart luggage with scales, tracking, and more. Here are our favorite pieces.