Advertise here with Carbon Ads

This site is made possible by member support. ❤️

Big thanks to Arcustech for hosting the site and offering amazing tech support.

When you buy through links on kottke.org, I may earn an affiliate commission. Thanks for supporting the site!

kottke.org. home of fine hypertext products since 1998.

🍔  💀  📸  😭  🕳️  🤠  🎬  🥔

What’s the Fastest Way to Alphabetize Your Bookshelf?

Let’s say you’ve got a bunch of books that need to be sorted alphabetically by author. What’s the fastest way to accomplish this task? Luckily, efficient sorting is a problem that’s been studied extensively in computer science and this TED-Ed video walks us through three possible sorts: bubble sort, insertion sort, and quicksort.

For more on sorting, check out Sorting Algorithms Visualized, sorting techniques visualized through Eastern European folk dancing, and a site where you can compare many different sorting algorithms with each other. (via the kid should see this)

Discussion  5 comments

Carolyn BG

Content warning for any other librarians in the audience: This article does not contain information relevant to an actual library.
It envisions a pretend book depository with pleasing colors, clearly marked spines, ample shelf space, and students eager to flock to the stacks.
This is a good explanation of how sorting works in computer programs. It will give you absolutely zero advice on more efficient shelf reading.

Jason KottkeMOD

Ok now I want to read or watch about how actual books are shelved, what the tradeoffs are, etc.

Carolyn BG

Same, actually! There are great videos on LibraryTock about book processing like this one: https://www.tiktok.com/@thecontouredlibrarian/video/7366393666413317406
It helps to keep the books in order while processing them so you don't have to start from scratch when you get to the shelves. I like to have a huge pile and then slot them in where they go among the existing alphabetized books. (Not to mention that in an academic library, the books are probably organized by Library of Congress codes and then alphabetized within the category.)

Reply in this thread

David Leppik

While I appreciate a good computer science lesson, this has nothing to do with humans sorting books. Humans can compare many books at a glance in less time than it takes to reach for a book. A more realistic algorithm is a variant on bucket sort, where you make a stack for each letter of the alphabet and then sort each stack. This is also more parallelizable, for humans or machines. It also takes advantage of human memory and our ability to make ternary or more complex comparisons.

This distinction is actually relevant to CS, where real-world algorithm comparisons don’t assume comparisons are the limiting factor. Some classic analyses treat comparisons and swaps separately. On modern hardware, branch prediction failures (the CPU guessing wrong and having to redo work) are more relevant than the time it takes to do any work.

enbeecee

I've actually had to sort a whole bunch of books or CDs, and the easiest way (for me) was to place all the items whose creator's last name started with "A" into one pile, then "B," etc. Next, alphabetize the piles. Now start putting the piles on the shelves.

The practical flaw in this video is the idea that keeping all the books except one on the shelf at all times during the sort is a real goal.

And on a real bookcase or CD rack, be sure to leave some empty space on each shelf to allow for future insertions…

Hello! In order to leave a comment, you need to be a current kottke.org member. If you'd like to sign up for a membership to support the site and join the conversation, you can explore your options here.

Existing members can sign in here. If you're a former member, you can renew your membership.

Note: If you are a member and tried to log in, it didn't work, and now you're stuck in a neverending login loop of death, try disabling any ad blockers or extensions that you have installed on your browser...sometimes they can interfere with the Memberful links. Still having trouble? Email me!