A Human Sorting Algorithm
January 19, 2015 11:02 AM   Subscribe

My mom has inherited my dad's 2,000 record albums, most of which are movie soundtracks. She is trying to decide whether to sell them or donate them, and step one is sorting and cataloging. They're not in any order. Is there some good way of alphabetizing them where they live, in a small room without lots of floor space to make piles?

It's hard to tell what most of them are without removing them one by one from the shelves they're on. I bring that up just to say that she can't really get a sense of how many As, Bs, Cs, etc there are without examining them individually.

They're on huge shelves which are broken into sections, with each section holding maybe 100 albums. And the sections are packed. There's no extra space.

A perfect solution would involve taking them all down, making a stack of As, a stack of Bs, etc, and then reshelving them, but she doesn't have the space for that. She could make a few stacks or piles off the shelves, but she will have to do most of the sorting in place.

I feel like there has to be a smart way to do this, maybe used by libraries or bookstores, but I can't quite figure it out. She can sort each shelf on its own, but then how does she combine all the As without pulling down every album to make space?
posted by grumblebee to Home & Garden (29 answers total) 8 users marked this as a favorite
 
Best answer: You can alphabetize in place. It just takes a long time and is sort of a hassle. But basically the process is like this.

- figure out where you're going to start
- take the second album after the start location
- figure out if it goes before or after the first alphabetically
- put it there
- grab the third album
- repeat, alphabetizing the third album among the first and second
- repeat, take each record from the unalphabetized part, put it in order in the first chunked and sorted area

The great thing about this is that you don't have to take anything out except one album at a time. The other great thing is you can stop at any point and put a "Up to HERE is alphabetized" marker and leave it, for days or weeks or forever!

Of course problems arise when you're not sure how to alphabetize, or by what. Realistically people can get buried in these projects forever when at the end of the day old media historically isn't super valuable unless your dad is someone famous or the collection is in some way special. You could have a special collections librarian assess it as-is to see if this is even likely to be possible before starting this task. That said, if your mom enjoys this sort of thing, then yes, this is how to do it. Maybe take five albums out of each crate as you go to give yourself room to move but then basically just set them aside and put them back in at the end.
posted by jessamyn at 11:11 AM on January 19, 2015 [9 favorites]


Couldn't you kind of do it using a leapfroggish method, if space is the concern? i.e., pull all the As, pull all the Bs, pull all the Cs, but then put the As back on the shelf at the beginning as soon as enough room appears. This way you'd only have to have as many records as necessary out on the floor at one time.
posted by threeants at 11:11 AM on January 19, 2015


I would use an Excel sheet. Assign each shelf a designation. So if you have a set-up like:

_________ _________ _________
_________ _________ _________
_________ _________ _________
_________ _________ _________
_________ _________ _________

You could have each column A, B, C, and then each row 1,2,3,4,5

Then you enter the records into an Excel sheet one shelf at a time with the following attributes:
Artist Last Name/Group, Artist First Name, Album Title, Shelf Name (i.e. A-3), Condition

This way you can go shelf-by-shelf, and end up with a fully sortable list and a way to find each record again. If you then want to try to sell, you then have a database and an easy for potential buyers to browse.
posted by DoubleLune at 11:12 AM on January 19, 2015 [3 favorites]


Instead of sorting them, I would focus more on cataloguing them.

1.) Label each shelf (or, preferably, portions of a shelf, like if they are stored in something like an IKEA Expedit or Kallax.
2.) Download a barcode scanning app, a quick google has pointed me to something called iCrates which is specialized for tagging vinyl.
3.) Scan each album, tag with the shelf ID

Now you've got a nice list (that could be put in a spreadsheet or whatnot) of what's there, with an approximate location. Using the list, you can pull the albums of particular value (monetarily or sentimentally).
posted by sparklemotion at 11:23 AM on January 19, 2015 [4 favorites]


If the overall goal is selling/donating most of them, and not keeping/cataloging/appreciating, I would look into barcode scanning apps... and on preview sparkle motion beat me to it!

Alternatively, if smart phone based scanners aren't practical for whatever reason, I'd look into adding one extra book case, and alphabetizing onto that one, and repeat until they are all alphabetized wherein you can more easily figure out how many A's or B's there are.
posted by fermezporte at 11:28 AM on January 19, 2015 [1 favorite]


You would like to sort them in-place, and you would like touch each album only once. You would like to catalog them at the same time.

Get 52 index cards, and for each letter of the alphabet, label two cards with that letter. Write
large, and use only one half of the hard. Insert these pairs into the shelves between records, equally spaced along the shelves, so that the letters that are written on them are clearly visible.

Now, for each album that has not been cataloged:
Pull the record from the shelf.
Note the Artist, name of the album, recording number, and condition of the cover.
Using a computer at this time might save you time later.
Find the pair of cards that are labelled with the same letter as the last name of the solo
artist, or the first letter of the group.
Insert the album between those cards.
You can alphabetize within the letter of alphabet by simple inspection.

When all the albums have been placed between their appropriate cards, you are finished.
posted by the Real Dan at 11:36 AM on January 19, 2015 [3 favorites]


Best answer: Theoretically, quicksort is the way to go: pick a "pivot" album somewhere in the middle of the room, and then swap albums such that all of those alphabetically before the pivot are physically in front of it, and all of those alphabetically after it are physically after it. Repeat recursively: quicksort the pre-pivot albums, and quicksort the post-pivot albums (picking new pivots on each pass).

I usually end up sorting my CDs (similar problem but smaller size) with a modified mergesort: pull out the biggest chunk you can comfortably work with in the space, sort it, put it back, pull another chunk. Then merge the sorted chunks. It's the same performance class as quicksort, but it has always felt more satisfying to me, because you see the little sorted chunks and that feels like progress. Quicksort may be faster (depends on how sorted the albums already are and on what pivots you pick...which are probably both random in your case) but it feels like you're mindlessly swapping things for a long time.
posted by orangejenny at 11:46 AM on January 19, 2015 [3 favorites]


Orangejenny has it. Quicksort is usually the fastest way to sort a bunch of random items. In the worst case, it is no better than a bubble sort, as jessamyn suggests, but in practice, it is usually an order of magnitude faster.

In technical terms, a bubble sort increases in time exponentially, while a quicksort usually increases in time linearly.
posted by musofire at 12:18 PM on January 19, 2015 [1 favorite]


I suggest a combination of what others have suggested. And let the computer do the quicksort for you.

Phase 1: Catalog
1. Two people work in tandem. Someone types, the other reads. The typist enters each album into Excel (or spreadsheet of choice). Save frequently. When done, sort the list in Excel. You now know the correct order and a computer has done all the algorithmic stuff for you without wearing down your record jackets and without giving you blisters.
2. Assuming each section is of uniform width, you can approximate how many albums fit in a section (total number of albums divided by number of sections). You also know the distribution of letters, and you know approximately how many sections it will take to accommodate each letter (add a second column to your spreadsheet; you could use this formula in Excel to figure out in which section each album should be, approximately (=CEILING(ROW()/albums_per_section,1))), with the result value being the section number. Use this as your guide to Phase 2.

Phase 2: Physical Sorting
1. Use sticky notes to approximate which section will contain which letter(s), labeling the first section A and the last section Z, and everything in between according to your spreadsheet.
2. Take out an album, put it in the correct section, in a sorted position. Use a marker for each section to denote which albums are sorted and which haven't yet been.
3. When you put your sorted album on the shelf, it will likely displace another unsorted album; if so, go to #2. If a section is full, move to the next section with unsorted items. Go to #2. If all sections are sorted, you are done.

This method means each record is pulled out approximately twice, once for cataloging, and once for sorting. Records will vary in width and will be distributed unevenly, but you can accommodate that as you go.

If the sections are not uniform width, you could tweak the algorithm to be albums per foot instead, and then substitute that in the function above. Your stickies for each letter would then be per foot instead of per section.
posted by tempestuoso at 12:21 PM on January 19, 2015 [1 favorite]


Theoretically, quicksort is the way to go

Except that the Real Dan identifies the constraint here: it's not that comparisons are expensive, it's that accesses are. ("Hard to tell what most of them are without removing them one by one from the shelves they're on.") For quicksort you're going to be accessing each record multiple times.

I rather like his suggestion of an in-place radix sort, although I think it under-estimates the cost of "alphabetize within each letter by simple inspection". (Although the question suggests that grouping by initial letter etc might be useful and sufficient in itself: "a sense of how many As, Bs, Cs" etc.)
posted by We had a deal, Kyle at 12:22 PM on January 19, 2015 [2 favorites]


I also think number of accesses (pulling off the shelf and replacing) is the constraint here, after working space available. jessamyn's bubble sort is going to be unpleasant and take a long time, but also has the 'take a break at any point' advantage she mentioned. Having one in hand, you at least can half-split the already-sorted section and binary search for the correct position, which cuts down accesses a lot.

I feel like this is one of those situations where biting the bullet and just getting started is going to outweigh any advantage by being clever.

Write down your sort policy decisions as you go, and stick to them consistently. You don't want to switch policy in the middle. Is Jimi Hendrix "J" or "H?" Or T when it's The Jimi Hendrix Experience?
posted by ctmf at 1:02 PM on January 19, 2015 [1 favorite]


If a barcode scanner will pick up the details of the record (?yes?) then that seems the absolute best way because you handle each record once, and you don't need to find a new place for it and you end up with an amazing and effective catalogue with a modest amount of effort rather than just a sorted pile of records with a less modest amount of effort.
posted by Sebmojo at 1:13 PM on January 19, 2015


No, because you still have to put them all back on the shelf sorted. The scanner would help make a catalog, but wouldn't reduce the handling any unless you also put a sticky note or something on the record so you could read its information without pulling it down. (which isn't a bad idea)
posted by ctmf at 1:20 PM on January 19, 2015 [1 favorite]


If you can record *where* the album is (approximately) you don't have to put them back on the shelf in sorted order.

If the albums are stored such that it's reasonable to think of them as being in "bins" of say 25-50 records each, then your catalogue can tell you that ELP's Brain Salad Surgery is in Bin #42, and when you need to, you can go to bin #42, flip through the 25-50 records, and pull what you need.

It's not as efficient on the retrieval end as having the whole set by alphabetized, but I'm guessing that OP will probably only need to actually retrieve a small percentage of the total collection. No sense in moving around a bunch of albums that won't really be touched again.
posted by sparklemotion at 1:31 PM on January 19, 2015 [1 favorite]


In fact, that's what I like now. The Real Dan's index card radix sort, but when you pull down a record, take a yellow sticky and write that album's sort info (band name or whatever) on it. Stick it on the album sticking out like a flag so it can be read with the album on the shelf. Then continue.

That makes the Real Dan's "simple inspection" sort within the group not require pulling down any albums.

The yellow sticky tags would also make jessamyn's sort pretty quick, too.
posted by ctmf at 1:32 PM on January 19, 2015


QUICKSORT! because humans are involved, not computers, and humans can't do complex repetitive actions reliably thousands of times.

"Fastest" algorithms do not usually take into account the need to resort everything from J-P because Jack misheard the instructions.
posted by IAmBroom at 1:36 PM on January 19, 2015


Best answer: Assuming barcode scanning works, then you take each section and give it a ref (A1, A2, etc) and then record a record's position in that section (1-150 or whatever). Then if you want an album that's, say, c5 at 92 you pull out a record a bit more than halfway through, see on your sheet that the one you pulled out is actually 85, and count seven records forward.

Haha this question is like nerd catnip (lots of good answers).
posted by Sebmojo at 1:36 PM on January 19, 2015 [5 favorites]


Response by poster: Thanks for the great suggestions so far. Just a quick note. The barcode suggestions are good, but I'm more concerned with sorting than cataloging them right now. My dad actually made a complete list of the LPs (including the serial number of each one), which we have. The problem is finding any item on the list. Right now, if a collector looked at the list and said, "I'd love to buy the original Star Wards soundtrack from you," I wouldn't know how to find it, because the albums are not in any order.
posted by grumblebee at 2:06 PM on January 19, 2015 [1 favorite]


Sparklemotion/sebmojo - I like the idea of just making a list of pointers to record positions and not bothering to sort the physical records, except for one thing. If someone moves any of them browsing, you're screwed. And you have no way to notice that on casual inspection, like you would if one was out of place alphabetically.
posted by ctmf at 2:15 PM on January 19, 2015


Oh, geez, no need to learn Quicksort. You probably have room for four or so stacks, so use that. Make stacks of sections. Then make letter stacks for one section at a time (maybe 6-7 for each letter) and sort the letter stacks.

If you have to stop in the middle, that's fine, but this sounds like kind of a fun family activity for an evening or two.
posted by amtho at 2:35 PM on January 19, 2015


Response by poster: Amtho, I'm a little dense. Can you explain what you mean by "make stacks of sections"? I'm also confused by "6-7 for each letter." I'm thinking 26-letters times 6-7! That's a lot of stacks. But I'm sure you don't mean that.
posted by grumblebee at 2:44 PM on January 19, 2015


The idea of the barcode(at least my version) is that you include the location of the album. Divide the shelves in manageable chunks. Say you label them 1A (bookcase 1, shelf A) or 1A1 (includes section a within shelf 1). Then for each album, once it is in your system, you know exactly where to go to look for it and only have to sort through the albums in that section to find the one you want. Compared to alphabetizing, it takes a few extra seconds to check the location but saves so much hassle in sorting it should be a big win. If you want things sorted more finely, after you have your master list, you can go into each section or subsection and alphabetize. The only downside is that albums by the same artist won't be sorted together (assuming you use artist name to alphabetize) but I am guessing that the percentage of albums you will need to access will be small compared to the size of the collection.
posted by metahawk at 3:50 PM on January 19, 2015


There's lots of great advice here about efficient sorting methods, but I'm wondering how necessary it is to begin with the sorting process, given that the end goal is getting rid of the records and that you've already got a list of all of the albums.

Presumably you're going to decide what to sell or donate based on the value of the records. There are some soundtracks that are worth a lot but if they're mainstream American soundtracks, most are likely to be in the $1-10 range. That's obviously not nothing given how many there are, but in your position, unless you need money badly and have a ton of free time, I would attempt to sell them all to a record dealer for a few thousand dollars rather than hassle with organizing them and selling them individually.

What you might want to do first is try to separate the valuable records (if any) to sell individually. You can use discogs to price the records. You probably don't want to search for every record. The two broad categories most likely to be valuable are Italian and blaxploitation soundtracks. Other European ones are probably worth a check, too. You might even just post the list on a vinyl message board or something, say you've inherited this, and ask if there's anything especially notable in the bunch.

Then after you've figured out if there are records worth selling on eBay or whatnot you could begin the process of going through them to pull out the records that you want. This will obviously be more time consuming than it would be if they were sorted, but much less time consuming than sorting everything just to make it easier to find the fifteen records worth $50 or more.
posted by vathek at 4:35 PM on January 19, 2015 [3 favorites]


jessamyn's insertion sort (not a bubble sort) is the best method for sorting, because it's one access per record and in place, and the comparisons are easy, so the fact it's quadratic on comparisons isn't a big deal at all because the person sorting will pretty much choose the right place to put the record in first or second time, rather than looking through the whole of the sorted list for the correct place to put it.
posted by ambrosen at 5:23 PM on January 19, 2015 [3 favorites]


(To be pedantic: the insertion sort is one access per record you're inserting plus one access for each record you compare it against in order to find the insertion point.)
posted by We had a deal, Kyle at 5:28 PM on January 19, 2015


If the records are in 100-album sections, it'll be a pain to keep shifting records over to the next sections to make room. Imagine if you need to put a record in the first section, but you have to move a record into the second section to make space, then move a record out of the second section to make room in it, etc, potentially all the way to the end.

But if you have a list of all the LPs, and if you can sort the list, then tempestuoso's plan sounds best: you'll only need to pull out each album once, and you shouldn't have to shift records between sections to make room.

You'll need to know how many records fit in each section. With the section sizes and the sorted list, work out which album comes first in each section. If it really is 100 albums per section, then it will be the first, 101st, 201st, 301st etc album on the list. Write down those albums on index cards and use them to mark the sections.

Then it's as tempestuoso says: take an album out and shelve it in the correct section. Make room by pulling out an unsorted one, and do that one next.

"nerd catnip" hahahaha! "Hey, it's a B-tree problem!" so busted
posted by kadonoishi at 11:57 PM on January 19, 2015


explain what you mean by "make stacks of sections"? I'm also confused by "6-7 for each letter." I'm thinking 26-letters times 6-7!

Sorry, that made no sense. I've had more time to think, also, so here's a slightly improved version. Also, sorry for dissing quicksort, it's not complicated in concept, just not necessary if your environment isn't really as restricted as computer memory used to be :)

This method is designed to let you work in a group with one or two other people and get the project done quickly, with minimum eyestrain, and taking advantage of a little stacking space in the room (which also gives a little working space around the albums on the shelves).

It does assume that you'll try to do everything in a couple of days, though, since there will be some records out in stacks during the process.

In my mind I'm calling this the

divide-divide-conquer method


You should end up with 26 or so sections (one or more per letter) which can each be alphabetized at yours and your helpers' leisure.

You might want to get or make placemarkers for each letter of the alphabet that can sit between the albums and extend out to the side, maybe made out of paint stirrers or old folders. These will also be helpful later when you want to get something from the shelves.

In short, you'll have one group of albums you're focusing on in manageable stacks, and other groups in designated places on the shelves.

Since I'm bad at explaining things, here's a really long explanation:

1) First divide: Start by making four or so stacks until they start to get too tall (for example, one for A-G, one for H-M, one for N-S, one for T-Z). **adapt the number of divisions/stacks to your room's constraints** Take a record from the unsorted shelves, put it on the appropriate stack. This gives you some space on the shelves and starts dividing the problem into smaller chunks.

** (If you take some records from the lower-right _end_ of the shelf system, not just the upper-left, this will make space at the end as well as the beginning of the shelves. This way you can put the partially sorted T-Z section up in approximately the final destination for it. If it works out, you might not have to rearrange everything drastically mid-project).

2) Keep the room sane: Once the stacks start to get unwieldy, choose one stack to keep out (for example, the A-G stack), and move the other three stacks onto the new space on the shelves; be sure to leave space for more albums at the beginning or end of each section.

** _where_ you put these back on the shelves is worth considering. As mentioned above, it would be convenient to put the last section (T-Z) at the end of the shelves. You'll want to leave space to add more albums to each section, and more space will also be created wherever you get albums down from the remaining unsorted albums.

3) Second divide: Start to sort the remaining stack (that's not on the shelves) into smaller stacks. You could make 7 new stacks (one for each letter A-G), or, if surface area is limited, you could make 4 stacks: the first would be A+B; second C+D; etc.

Don't try to alphabetize everything just yet or you might make yourself crazy. If you have helpers, make sure everyone is _clear_ on when alphabetizing happens -- if some people are alphabetizing and others aren't, both groups will be frustrated.

** Once you've put one or two items into the new stacks, you can do this step at the same time as:

4) Finish filling the original (shelf) and new (stack) divisions: Now you're ready to get more unsorted albums from the shelf and put them into their correct sections, either into the 3 sections on the shelf or into the stacks on the table. If they are in the first part of the alphabet (A-G), put them on the matching letter stack.

** It's up to you to decide how much space on the shelves is helpful, and how much spreading out in the room is manageable. If the stacks in general get overwhelming, put some of the stacks on the shelf (maybe D, E, F, G) -- keeping them separated by letter. You can also divide up too-large letter stacks to be manageable (if necessary, for example, C could be two stacks, for example, maybe Ca-Cl and Cm-Cz). Just mark (mentally or visually) where the different sections are. The letter markers mentioned at the top will be helpful.

** If the sections you've made (from the original stacks) on the shelf get too large -- as you add to them from the unsorted records -- you'll have to shift them around on the shelves. Try to plan well to avoid this.

5) Put first set of letter sections on shelf - You should now have all the 'A' albums from the original collection together in a stack. Put them on the shelf for later sorting, preferably with letter markers showing where each letter section begins. Yay! Do the same for the 'B', 'C', ... 'G' albums.

** If you had to make two-letter stacks (A+B in one stack), go through the stack and put the A's on the shelf, keeping the B's out, then when you're done, you'll have the B's all together ready to shelve next.

** If you had to put some of the first section's letters up on the shelf because doing all of A-G was too overwhelming, then they may already be where they should be. If they need additional dividing, do that now.

6) divide the other multi-letter sections - Divide the H-M section into smaller stacks, one for each letter (or adjust as needed, as in step 4), then put the letter sections back up onto the shelves. Do the same for N-S and T-Z.

7) Alphabetize each letter section - Get all the A's down and alphabetize them, then put them back up on the shelf. Etc.
posted by amtho at 2:04 AM on January 20, 2015


As a sanity check - you assert there is no order to the records. They're not alphabetized by artist, or anything obvious - but could they be ordered by year of release, genre, record label, or some other metric that isn't immediately obvious, and possibly useful? it might be worthwhile to review a couple boxes with pattern recognition in mind. Related Youtube clip: High Fidelity.
posted by enfa at 11:11 AM on January 20, 2015


Sparklemotion/sebmojo - I like the idea of just making a list of pointers to record positions and not bothering to sort the physical records, except for one thing. If someone moves any of them browsing, you're screwed. And you have no way to notice that on casual inspection, like you would if one was out of place alphabetically.

Print off stickers going 1-2000, and put a sticker on each record as you go.
posted by Sebmojo at 7:19 PM on January 20, 2015 [1 favorite]


« Older Help me identify these skis please! (Advice about...   |   Hiring in-home help for someone with Parkinson's:... Newer »
This thread is closed to new comments.