Slashdot Mirror


Ask Slashdot: How Do You Sort?

camperdave writes "I was recently going through a pile of receipts and other papers to put them into order by date. Lacking one of those fancy sorting sticks they have at the office, I wound up with all sorts of piles and I was getting confused as to which pile was for what. Finally, it struck me: Why don't I use one of the many sorting algorithms I learned back in my computer science classes? So I swept all the papers back into the box and did a radix sort on them. It worked like a charm. Since then, I've had occasion to try quicksorts and merge sorts. So, when you have to physically sort things, what algorithm (if any) do you use?"

195 comments

  1. Ob xkcd by Geoffrey.landis · · Score: 5, Funny

    The obligatory xkcd

    --
    http://www.geoffreylandis.com
    1. Re:Ob xkcd by phrostie · · Score: 1

      Tiny bubbles

      in the Wine.org

    2. Re:Ob xkcd by Anonymous Coward · · Score: 0

      Don't forget - Applied sorting.

  2. Bogosort by Anonymous Coward · · Score: 0

    Bogosort, of course. I'm only human.

  3. Bucket sort or bin sort by Anonymous Coward · · Score: 2, Funny

    Some days I use one; other days I use the other.

    1. Re:Bucket sort or bin sort by Anonymous Coward · · Score: 0

      Ditto. Figure out a few few sets (last week, two weeks ago, last month, two months ago, everything before that, etc.) make a stack for each and keep the stacks in order. Then sort each stack with an insertion sort.

  4. Bubble sort by Anonymous Coward · · Score: 3, Insightful

    Given that your pile was probably pretty well sorted to begin with, a bubble sort could actually have been the best solution. After all, the pile probably grew in chronological order.

    1. Re: Bubble sort by pollarda · · Score: 1

      Definitly bubble sort. I usually throw in the Matrix trillogy and if I'm not done, I can follow it up with the extended version of Lord of the Rings. The great thing is that if my wife checks in on me, I'm sorting like mad the whole time!

    2. Re:Bubble sort by Black+LED · · Score: 2

      I scan all of my receipts, bills, product manuals, boxes, etc. into my PC and recycle the physical waste. This way I can quickly and easily sort and search. It also makes it simple to make backups or place copies online that I can access at any time from anywhere.

    3. Re:Bubble sort by ndogg · · Score: 1

      Yeah, but bubbles are messy, but they are fun, but it's so hard to get them in order with them floating around, and people popping them. That's the worst. Just once I have them all in order, someone goes and pops one of them. I could never figure out where to put the bubbles that have another bubble inside them.

      --
      // file: mice.h
      #include "frickin_lasers.h"
    4. Re:Bubble sort by camperdave · · Score: 1

      I scan all of my receipts, bills, product manuals, boxes, etc. into my PC and recycle the physical waste. This way I can quickly and easily sort and search. It also makes it simple to make backups or place copies online that I can access at any time from anywhere.

      Interesting. So, do you OCR the scan? Or do you tag the resulting scan somehow? How do you store them? PDFs? Maybe Microsoft OneNote?

      --
      When our name is on the back of your car, we're behind you all the way!
    5. Re:Bubble sort by Anonymous Coward · · Score: 0

      I name it by date; and also store it as a PDF in my google drive so it's automatically OCRed; but depending on how good your phone camera is, something like 'receipt ninja' might work better.

  5. merge sort by Anonymous Coward · · Score: 1

    if you are piling your receipts up chronologically, it should be merge sort

  6. Bogosort by igny · · Score: 4, Funny

    I just drop a pile of papers on the staircase, and then repeat if they did not land in the right order.

    --
    In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
  7. Shredsort by Anonymous Coward · · Score: 5, Funny

    I find Shredsort to be the fastest.

    1. Re:Shredsort by Anonymous Coward · · Score: 5, Funny

      Hmm, that's O(n).

      Trashsort is O(1)

    2. Re:Shredsort by ClickOnThis · · Score: 2, Funny

      Hmm, that's O(n).

      Trashsort is O(1)

      But IdentityTheftSort is O(n!).

      --
      If it weren't for deadlines, nothing would be late.
    3. Re:Shredsort by iced_773 · · Score: 1

      Actually, for large enough inputs, you might have to take multiple armfuls. Still O(n), but definitely smaller constant factors than shredsort.

    4. Re:Shredsort by NotQuiteReal · · Score: 2

      Is dumpster diving ID theft really that much of a threat from old receipts, which generally have no "interesting" information? Seems to me all the juicy ID data has gone digital...

      I just compromise - when I have a large amount of old paperwork I need to dispose of, rather than waste time overheating my shredder, I just toss piles into a sink of hot water, stir a bit, crumple, tear, knead, then put in a trash bag, preferably on "fish night", after dinner.

      Since I work from home, I can wait until just before the trash pickup before putting out my bin... good enough for the risk.

      --
      This issue is a bit more complicated than you think.
    5. Re:Shredsort by Anonymous Coward · · Score: 2, Funny

      > But IdentityTheftSort is O(n!).

      I thought it was O(noes!) ?

    6. Re:Shredsort by Anonymous Coward · · Score: 0

      I use one of these: http://www.amazon.com/Harold-Imports-Stainless-Steel-Multi-Blade-Scissors/dp/B000X7IJKI/

      They're extremely slow, but very Xen. When I have trouble concentrating at work, I bust out my penta-scissors, open a credit card or bank statement, and get to cutting, one sheet at a time. You can get the pieces really tiny (smaller than security microcut), and when you're finished you're much more relaxed.

    7. Re:Shredsort by Anonymous Coward · · Score: 0

      Dumpster diving has "continued unabated" (http://www.identitytheft.info/victims.aspx). Just because more numbers are stolen electronically doesn't mean fewer numbers are collected physically. It's also possible that physically stolen numbers are worth more on the black market because there's less risk that they'll be invalidated before being used.

      If it made sense to shred your documents 15 years ago, it makes at least as much sense today.

    8. Re:Shredsort by DarwinSurvivor · · Score: 1

      Hmm, that's O(n).

      Bah, you just need a bigger shredder!

    9. Re:Shredsort by Anonymous Coward · · Score: 0

      Firesort is just 1

    10. Re:Shredsort by Anonymous Coward · · Score: 0

      I just compromise - when I have a large amount of old paperwork I need to dispose of, rather than waste time overheating my shredder, I just toss piles into a sink of hot water, stir a bit, crumple, tear, knead, then put in a trash bag, preferably on "fish night", after dinner.

      Instead of trashing it, you should add some glue and make paper mache sculptures.

    11. Re:Shredsort by smart_ass · · Score: 1

      Assistant-sort is by far the least work though.

      --
      Ouch ... did I just say that.
    12. Re:Shredsort by shentino · · Score: 1

      So you use virtualization to sort?

      Trippy.

    13. Re:Shredsort by Alan426 · · Score: 1

      I used to use a similar strategy when my kids were in diapers. Nobody's dumpster diving in *that* bag.

    14. Re:Shredsort by Anonymous Coward · · Score: 0

      Hmm, that's O(n).

      Trashsort is O(1)

      But IdentityTheftSort is O(n!).

      Unlikely to happen.
      I also don't see any of the competitors diving into that dumpster and it is likely that understanding the design will cost more than designing a competing product.
      If some teenager dumpster-dives and finds a backdoor that leads to an expensive recall of the product for updating and a possibly damaged reputation then I'd say that it would be worth it.
      Considering what pops out of schools these days we could easily spend that money trying useless new workers. Having competence dropped in our laps doesn't happen every decade.

    15. Re:Shredsort by Megane · · Score: 1

      So, "poopsort"?

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    16. Re:Shredsort by snax · · Score: 1

      Exactly my thought. Well done.

    17. Re:Shredsort by Anonymous Coward · · Score: 0

      Firesort is also O(1) and is both more fun and more secure!

  8. Ditto. by pla · · Score: 1

    I too use radix sort, when I have a large number of unsorted items. I usually use a bidirectional bubble sort for smaller piles (ie, if I need to hold them all in my hand at once). And I've occasionally used a merge sort, which works great when you have to combine a handful of already-sorted piles.

    Any of the more complex algorithms just don't work well in the real world - You either need too much (brain) stack space, or too much extra storage (desktop), to make it worth doing.

    1. Re:Ditto. by Anonymous Coward · · Score: 0

      Combsort or Rakesort are modified bubble sorts. They're as small and simple as bubblesort to implement (so they fit nicely in micro-op caches), but have performance closer to quicksort for small sequences.

    2. Re:Ditto. by Anonymous Coward · · Score: 0

      do you also use seconds since the epoch as your radix sort index, to make it faster?

    3. Re:Ditto. by Immerman · · Score: 1

      Actually for small sets insertion-sort is probably the easiest and is O(n) or faster when executed by a processor that can simultaneously observe the entire sorted list in a medium that allows O(1) insertions at any point. Bubble-sort on the other hand is horribly tedious.

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
  9. GPUs by jones_supa · · Score: 0

    Can the shader units of a GPU be harnessed to accelerate sorting? I'm not sure if sorting is a problem which be adapted that way or not.

    1. Re:GPUs by K.+S.+Kyosuke · · Score: 4, Funny

      Can the shader units of a GPU be harnessed to accelerate sorting?

      They can, but you have to either use a very slow GPU, or have very fast fingers.

      --
      Ezekiel 23:20
    2. Re:GPUs by ja · · Score: 2

      46.3.1 Implementing Odd-Even Merge Sort http://http.developer.nvidia.c...

      --

      send + more == money? ...
    3. Re:GPUs by TeknoHog · · Score: 1

      GPUs are great at doing stuff in parallel, so they should be great for modelling a quantum computer. Then you can use http://en.wikipedia.org/wiki/G...

      --
      Escher was the first MC and Giger invented the HR department.
    4. Re:GPUs by mikael · · Score: 3, Interesting

      Yes, they are called compute shaders. There are several parallel algorithm, of of which is called the bitonic sort.

      http://en.wikipedia.org/wiki/B...

      You just load all your data into GPU memory, with one data element per thread, then at each stage, use one thread to compare pairs of data.
      There's a very specific pattern which is specified by this web page.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    5. Re:GPUs by Anonymous Coward · · Score: 0

      Of course, the problem is getting the papers into, and out of, the shader unit.

    6. Re:GPUs by Anonymous Coward · · Score: 0

      Grovers algorithm is a searching algorithm not a sorting one. So, to sort a database, that would be n! things to search, leading to an O(sqrt(n!)) algorithm, which is entirely slow. Moreover implementing the quantum *ORACLE* in such situations is non trivial: given a permutation how would one implement an oracle accepting to verify that the given permutation sorts the database? But this isn't particularly difficult. The issue comes with being able to call the oracle in superposition, etc.

      Also modelling quantum computers for Grovers search would involve tracking O(n) qubits which is O(2^n) real numbers to take care of, which is not useful or fast. Any way of getting around this (interestingly) shifts the domain of the problem from BQP to BPP, as 'a fixed amount of entanglement' is not enough to emulate quantum problems.

    7. Re:GPUs by Anonymous Coward · · Score: 0

      Bitonic sort is what you do with a fixed pipeline and glcopytexsubimage. Compute shaders would let you use actually efficient algorithms.

  10. I'd say heapsort by BabaChazz · · Score: 1

    given that what I have would be characterized as a "piling" system... but in fact it ends up being a merge sort generally, with individual stores sorted by bubble sort before the merge.

  11. Elementary operations by Anonymous Coward · · Score: 0

    Elementary operations don't have the same time cost in the real world than in computers. Take game cards for example. A deck doesn't have the same cost for inserting as the table container. Inserting a card in the middle of a deck is very easy and can be considered as being O(1): you don't need to move cards one by one to make space for the card you want to insert. That means insertion sort is O(n log(n)) for a deck of cards instead of O(n^2) for tables! Well, only if you use binary search to find the location where you must insert the new card.

    1. Re:Elementary operations by K.+S.+Kyosuke · · Score: 1

      Inserting a card in the middle of a deck is very easy and can be considered as being O(1): you don't need to move cards one by one to make space for the card you want to insert.

      It's exactly the opposite case compared to an array: finding the place is O(1) for an array, the insertion is O(N). With a deck of cards, the insertion is O(1), but finding the place definitely isn't O(1). Could be O(log N), though.

      --
      Ezekiel 23:20
    2. Re:Elementary operations by MickLinux · · Score: 1

      For receipts, it takes a little while to identify, so only binary compares are appropriate. Therefore, I'd go thru py pairs, sort the pairs, and stack them together crosswise on the bottom of the pile. That's sort groupsize one. Then take two groups, sort the groups with top-receipt compares, and join the groups and stack on the bottom. You're done when the receipts are all aligned correctly.

      Sorting coins, I designate clock positions for each coin type, grab the largest group and slide the group to the quadrant. On the return, I drag back any stragglers, either to the pile if mixed, or to the appropriate quadrant if not.

      Sorting feelings, I stop all direct thought on the matter, get some physical labor, and just work for a while. Then asevarious thoughts arise,I try to deal with each as rationally as I can. Which isn't very.

      --
      Correct Horse Battery Staple: 72 bits of entropy. Enter "Correct H" into google. When it generates the phrase, that's
    3. Re: Elementary operations by Anonymous Coward · · Score: 0

      The analogy of a deck of cards is a bit problematic, because you already know a great deal of information about the deck before you start sorting. Without counting, you know there are 52 cards, they are all unique, and they have a definite order that you can predict. If you knew all that about a collection of (otherwise) random inputs, you could sort them a lot faster. In fact, you could just get a new deck (already sorted) and throw out the original one.

    4. Re:Elementary operations by Immerman · · Score: 1

      That depends - the nature of the processor is also inherently different, and can look at far more than one card at a time - spread most of a sorted deck of cards in front of you, and I bet you can find the insertion point for a new card *far* faster than O(log N).

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    5. Re:Elementary operations by K.+S.+Kyosuke · · Score: 1

      I thought the N is allowed to be arbitrarily large. Your strategy is suitable for small Ns but appears to break down for large ones. Having said that, O(1) physical insert also breaks down at very large Ns due to simple laws of physics (even if the insertion time in a single stack is O(1) in theory, the inertia requires mechanical work proportional to the size of the stack of things to move, so it's yet another multiplicative N factor) so perhaps a divide-and-conquer strategy is advisable for a larger number of reasons. Hmm.

      --
      Ezekiel 23:20
  12. The Ignatius P. Reilly System by l0ungeb0y · · Score: 2

    By throwing all the files in the trash, you will create more filing space and avoid potential fire hazards.
    It's a truly revolutionary filing system which eases my pyloric valve.

    1. Re:The Ignatius P. Reilly System by lazy+genes · · Score: 0

      I use the ignitus system in winter when i need more heat and the floodus system in the spring to clear what's left.

    2. Re:The Ignatius P. Reilly System by R3d+M3rcury · · Score: 1

      Actually...

      Way back when, I had a filing system that worked fairly well for me. It was "On my desk." Everything that I got was put near me. Over time, it would end up being buried by other things. As those stacks got too high, it would be pushed away from me to create space for new items. So I could find things on my desk based on when I last used it. Stuff that I used often was close by, stuff that I didn't use was far away from me.

      Eventually, things would fall off the desk and the cleaning people would throw them out. If I didn't use it in the approximately three months that it took to fall off the desk, it probably wasn't important anyway.

    3. Re: The Ignatius P. Reilly System by Anonymous Coward · · Score: 0

      This is called a priority queue, and utilizes the principle of locality of reference. It's brilliant and practical. :)

  13. Hmm, chicken grease works good too and it smells l by Anonymous Coward · · Score: 1

    Hmm, chicken grease works good too and it smells like "home"
    Seriously, "news for nerds eh?"

  14. (Parallel) Radix Sort by Anonymous Coward · · Score: 0

    I usually attempt to express the items I am sorting in terms of ordinal keys.

    Out performs everything else when N is large.

  15. Radix sort by K.+S.+Kyosuke · · Score: 1

    I always did radix sort for that. Works nicely. Or was it an N-way merge sort? Sort of an ad hoc mixture of both, depending of the task at hand, I guess.

    --
    Ezekiel 23:20
  16. i dont need no stinking sort by Anonymous Coward · · Score: 0

    the real world is chaos and entropy. live with it.

  17. Usually by whites and colors. by Oligonicella · · Score: 1

    Sometimes I have to separate by material, but not often.

    1. Re:Usually by whites and colors. by Anonymous Coward · · Score: 1

      Racist.

    2. Re:Usually by whites and colors. by Anonymous Coward · · Score: 0

      fuck this your all acting lame..
      i mean the jo topic is riding the edge, but this is just plain fucked up.
      perhaps your pissed because a Jew has to loan you or your parents the money for their new house?
      perhaps you realized most of the entertainment industry is owned by jews
      perhaps you realized the Jewish Army (while not necessarily the smartest[but then again what army is]) is by far the strongest, most resourceful, armed force in the world.

      look @ the stats.

      perhaps your pissed that the jewish boy got the the bitch you wanted, because she found out your parents had to borrow money from his parents to get their new car or house. She knew whom had the cash and subsequently knew whom could really take care of her EVERY needs.. ;)

       

  18. How About SecretarySort? by stevegee58 · · Score: 1

    Dude, you need to let people who are paid less than you to do menial tasks like this. Seriously.

  19. the ultimate sort by pixelateddwarf · · Score: 1

    With real physical sorts I pipe everything to DEV NULL

    1. Re:the ultimate sort by Anonymous Coward · · Score: 0

      I used to do something like that whenever I would get around to doing things like organizing the clutter on my desk at home, etc... then I got married and my wife kept getting mad at me when I would effectively discard large swaths of unsorted stuff on the premise that I might be discarding important stuff. My theory was that if it was important, I should have remembered to put it away properly, and the loss of something important should convince me for next time.

      And she calls *me* a pack rat....

  20. Re:Hmm, chicken grease works good too and it smell by Anonymous Coward · · Score: 0

    MMM, ya it does, like grand-ma's chicken soup..great on a cold day, warms u up inside,
    thoughts of hollidays gone by,
    etc...

  21. How about Administrative Assistant sort? by Above · · Score: 2

    They don't let us call them secretaries anymore, but I agree with stevegee58. Let an administrative assistant sort, or better yet run them through a Fujitsu SnapScan and then let the computer do the sorting.

  22. Combined by Anonymous Coward · · Score: 0

    I find myself using a combination of bubble sort and selection sort if I need to sort physical items. Basically if two items near to each other are similar in value I bubble sort them. If I find an item that is unusually high/low in value I move it to the end of the row.

  23. Bucket sort followed by insertion sort by Anonymous Coward · · Score: 1

    Bucket sort to keep each individual stack small enough for the following insertion sort.

    1. Re:Bucket sort followed by insertion sort by Waffle+Iron · · Score: 1

      Bucket sort to keep each individual stack small enough for the following insertion sort.

      I think that's what people generally do: Bucket sort anything more than a couple dozen items, and insertion sort anything less.

      I've tried various other sorting algorithms on decks of cards just for educational purposes. I've found them to be mostly very hard for humans to perform. I think that's probably because what's usually kept in a computer's stack is not evident in the layout of items, so all that info must be juggled in your head. I think that I remember heapsort being especially hard to keep track of, and that quicksort was no picnic, either.

  24. Give every page a number. by leuk_he · · Score: 2

    0 Give every item a number.
    1 enter the date in excel.
    2 Enter the number in excel.
    3 Add one other search criteria in excel

    4 Sort in excell/

    Leave the papers alone. If you need to find a certain date, you know what numbers to look for.

    5 swear at person that threw them in the wrong order.

    1. Re:Give every page a number. by Anonymous Coward · · Score: 0

      that's brilliant (i'd opt for something more sql+web friendly, but yes, this!)! the real advantage is that the physical sort is synonymous with a clustered index, so if you need to fetch records by anything other than the clustered index you're stuck with a full table scan. this is the least amount of work/complexity in the long run for maximum gain.

      before this revelation, though, it was usually a merge-bubble hybrid

  25. Non-deterministic sort by kebes · · Score: 4, Interesting

    Human sorting tends to be rather ad-hoc, and this isn't necessarily a bad thing. Yes, if someone is sorting a large number of objects/papers according to a simple criterion, then they are likely to be implementing a version of some sort of formal searching algorithm... But one of the interesting things about a human sorting things is that they can, and do, leverage some of their intellect to improve the sorting. Examples:
    1. Change sorting algorithm partway through, or use different algorithms on different subsets of the task. E.g. if you are sorting documents in a random order and suddenly notice a run that are all roughly in order, you'll intuitively switch to a different algorithm for that bunch. In fact, humans very often sub-divide the problem at large into stacks, and sub-sort each stack using a different algorithm, before finally combining the result. This is also relevant since sometimes you actually need to change your sorting target halfway through a sort (when you discover a new category of document/item; or when you realize that a different sorting order will ultimately be more useful for the high-level purpose you're trying to achieve; ...).
    2. Pattern matching. Humans are good at discerning patterns. So we may notice that the documents are not really random, but have some inherent order (e.g. the stack is somewhat temporally ordered, but items for each given day are reversed or semi-random). We can exploit this to minimizing the sorting effort.
    3. Memory. Even though humans can't juggle too many different items in their head at once, we're smart enough that we encounter an item, we can recall having seen similar items. Our visual memory also allows us to home-in on the right part of a semi-sorted stack in order to group like items.

    The end result is a sort that is rather non-deterministic, but ultimately successful. It isn't necessarily optimal for the given problem space, but conversely their human intellect is allowing them to generate lots of shortcuts during the sorting problem. (By which I mean, a machine limited to paper-pushing at human speed, but implementing a single formal algorithm, would take longer to finish the sort... Of course in reality mechanized/computerized sorting is faster because each machine operation is faster than the human equivalent.)

    1. Re:Non-deterministic sort by Anonymous Coward · · Score: 0

      Yo dawg a heard you like algorithms and you use an algorithm to find the best algorithm so you sort while you sort.

    2. Re:Non-deterministic sort by Anonymous Coward · · Score: 0

      Sorting playing cards i see some of this:
      I usually sort one by one, keeping as many sorted cards visible as possible.
      If i see a similar card to the one to be sorted, i put it there (pattern recognition is cheaper than counting),
      if not, I will approximate the position and refine the approximation until i have a matching position.
      To be precise I verify just one neighbor candidate fully and only if I'm certain enough I check the other.
      And than there are remembered positions, at least for the ends of the sorted stack: like current min, current max, absolute min, absolute max or 3 of a kind somewhere

    3. Re:Non-deterministic sort by martin-boundary · · Score: 1
      Except of course _successful_ sorting is trivial - all it takes is someone to carry through their favourite method until the end.

      Smart people however use the CS sorting algorithms, and not some random, changed partway through, invented on the spot method. And that's because smart people know that the classic CS sorting methods have the optimal complexity among all comparison based sorting algorithms. There simply aren't any better methods that take less work, if you're going to compare iterms pairwise. BTW, there's a proof of that statement in Knuth, but this comment is too small to quote it in its entirety.

    4. Re:Non-deterministic sort by Anonymous Coward · · Score: 0

      BTW, there's a proof of that statement in Knuth, but this comment is too small to quote it in its entirety.

      How very Fermat of you.

    5. Re:Non-deterministic sort by wvmarle · · Score: 1

      Receipts I would always attach to an A4-sized paper (if not already that size), give it a serial number, enter it into my administration (GnuCash) using the actual date and add that serial number, and file it. As serial numbers are assigned while filing, no sorting needs to be done.

      Years later I can easily find a transaction using GnuCash's search function, and find it in the file with the serial number.

      Works like a charm.

      And as long as you do this on a regular basis, the receipts end up in your administration more or less sorted by date as well.

    6. Re:Non-deterministic sort by vux984 · · Score: 2

      And that's because smart people know that the classic CS sorting methods have the optimal complexity among all comparison based sorting algorithms.

      And even smarter people know that the classic CS sorting methods ONLY have the optimal complexity among all comparison based sorting algorithms when certain assumptions hold.

      Are you are in fact limited to comparison sorts? In practice, you aren't.

      I may realize that I don't actually need something chronologically, that I only need it down to a month so I can bucket sort a years worth of receipts, without comparing any receipt to any other receipts.

      As this is not a comparison sort. This is O(n)

      Secondly there is overhead in manually conducting a quicksort; so even if it has optimal asymtotic complexity it may not necessarily pan out in practice if you don't have enough things to sort. When doing my taxes for example, I can take a pile of 120 different receipts, bucket sort them into different 10 categories (phone bill, visa statements, internet... ) and then I've only got 12 things in each pile, and odds are they are likely already semisorted with 10+ of the 12 months already in the right order, or perhaps just in reverse order.

      By the time you've selected a pivot and divided it into two piles and are selecting new pivots I'll have finished and moved onto the next little pile.

    7. Re:Non-deterministic sort by Anonymous Coward · · Score: 0

      Only in theory. In practice the datasets are small and the underlying hardware platform has strange timings for elementary operations which together tilts things in favour of certain algorithms against others.

      Consider insertion sorting a deck of cards. It's O(n^2) "shifts", O(n*log n) comparisons and O(n) "random access" moves. This is usually regarded as an O(n^2) algorithm on a computer, not much different from bubble sort. However, when doing it by hand, the n^2 part doesn't even count and the rest is spent about 50/50 between finding the right place and moving those single cards there. The big hit comes when you have a deck so big you can't hold it on your hand. Until then, the algorithm is almost linear.

    8. Re:Non-deterministic sort by Anonymous Coward · · Score: 0

      ffuu. was supposed to reply to this: http://ask.slashdot.org/comments.pl?sid=4848289&cid=46379723

    9. Re:Non-deterministic sort by camperdave · · Score: 1

      And as long as you do this on a regular basis, the receipts end up in your administration more or less sorted by date as well.

      It's the "on a regular basis" thing that is the heart of the problem. I've let things pile up, and with GnuCash's date manipulation keyboard shortcuts having things sorted by date makes data entry easier.

      --
      When our name is on the back of your car, we're behind you all the way!
    10. Re:Non-deterministic sort by martin-boundary · · Score: 1

      You're confused about bucket sorting and radix sorting. You may also want to look at probabilistic and randomized algorithms. However, the important point is that best of class algorithms for sorting are already known, and always beat ad hoc methods devised by the uneducated. Given that sorting is rather boring to anyone but a collector or fetishist, there's no excuse for not using the proper algorithm.

    11. Re:Non-deterministic sort by vux984 · · Score: 1

      You're confused about bucket sorting and radix sorting.

      I doubt it, but you might be. Why do think I am?

      You may also want to look at probabilistic and randomized algorithms.

      And doing that by hand sounds a treat. Roll a fair dice between each action?

      and always beat ad hoc methods devised by the uneducated

      I contend for small sets, where the content of the set is known in advance by the sorter, and is largely already in order, that ad hoc human methods can beat formal classical methods.

      Why? Because several of the assumptions that the formal methods rely on for their 'proof of superiority' do not hold, thus the proofs do not hold under these conditions.

      , there's no excuse for not using the proper algorithm.

      For small enough sets, by the time you determine the 'proper algorithm', and come up with a system for implementing it properly manually, I'll be done sorting.

  26. binary sorting by Anonymous Coward · · Score: 0

    Probability I will need this (0-100)* How screwed I would be If I need and no longer have this (0-100) all /100.

    0-50 =0 = chuck it out
    51-100 = 1 = put it in the big pile.

  27. My method by synaptik · · Score: 5, Funny

    I punch 3 holes in every receipt: one each for parent, left, and right. Then I attach them all by string, in a balanced tree. If I need multiple search keys, I just use different colors of string, and different sets of holes. Rebalancing can be a bit of a bitch, after insertion. (I never delete.)

    --
    HSJ$$*&#^!#+++ATH0
    NO CARRIER
    1. Re:My method by marcosdumay · · Score: 2

      Your office must be interesting.

      Why don't you adopt a b-tree? That way you'll be able to delete. Yet, the best is running several sets of horizontal wires, and attaching each receipt on them (with strings, 1 receipt to many wires) based on the data you want to index...

      Or maybe you should start organizing the receipts in blocks in a cabinet, with only directions attached to the wires. But then you'll have an extra lookup... And don't forget to write what you'll add to the cabinet before you do so, somebody might call you and you may forget what you were doing.

    2. Re:My method by MarkRose · · Score: 1

      Thank you for that :)

      --
      Be relentless!
  28. Re:Hmm, chicken grease works good too and it smell by Anonymous Coward · · Score: 1

    wouldn't it be a shame if this thread is the most responded to within the whole topic discussion?

    Way to go DICE over-lords.

    commander Taco, where are you???

    but to stay on topic, Zogs would not be good, Chicken fat is :)

  29. merge or bin sort by khallow · · Score: 1

    If I'm sorting stuff lexicographically, I generally use bin sort (often grouping things into four or so large bins first like say A-G, H-M, N-S, and T-Z for sorts on people's surnames). For numerical records, I use merge sort. Sometimes I use both, like for sorting cards (bin sort on suit and then merge sort each suit). It can be quite a time saver when you have to sort a large number of paper records to learn these sorting algorithms.

    I suppose what could make this story more interesting is what sort of nontrivial algorithms do people use on a regular basis in a non-programming situation?

  30. Re:hey slashdot. since this forum has degraded to by Anonymous Coward · · Score: 1

    why is this modded as off topic?

    seriously, its totally relevant, just look at the proceeding subject matter and you tell me whats "really off topic"??

     

  31. I think this paralells the jerkoff coment below by Anonymous Coward · · Score: 0

    I think this paralells the jerkoff coment below

  32. OldSpiceSort by Anonymous Coward · · Score: 1

    define oldSpiceSort(list):
              system("man look")
              nowBackAtMe() // the list is now sorted
              return list

  33. Two-pass bucket sort by JazzHarper · · Score: 3, Interesting

    First by rank (13 buckets) then by suit (4 buckets). I can typically sort a well-shuffled deck of bridge cards in about 85 seconds. That's far from the world record, but significantly faster than most people can do.

    1. Re:Two-pass bucket sort by Lehk228 · · Score: 2

      if you have a table to work with sort directly into a 13x4 grid

      --
      Snowden and Manning are heroes.
    2. Re:Two-pass bucket sort by TechNeilogy · · Score: 1

      This is also how I sort documents. First into piles by source, then by data.

      --
      "The wisdom of the Patriarchs was that they *knew* they were fools." --Master Foo
  34. Yes - the Pile sort... by NotQuiteReal · · Score: 4, Funny

    Assuming the bottom of the pile is the oldest....

    1) decide how tall you would like the pile.
    2) move that much of the pile to a temp location.
    3) remove the remaining pile to the garbage/recycle/shred bin, as appropriate
    4) move the temp pile back to the production pile area.


    You never said you were looking for anything... sorting piles of kipple seems to be a rather dull hobby.

    --
    This issue is a bit more complicated than you think.
    1. Re:Yes - the Pile sort... by Blaskowicz · · Score: 2

      Gaston Lagaffe (belgian comics character) had a similar pile sort method, somewhat more elegant.
      1) pile stuff next to the table/desk's border
      2) wait so much that you have multiple piles, horizontally arranged
      2) when you have too many piles, push them so that the first one falls off the table

      I can't google it successfully, so instead here's this one : Gaston sorts an office cupboard's content http://jfmabut.blog.tdg.ch/media/02/01/979637923.jpg

    2. Re:Yes - the Pile sort... by rpstrong · · Score: 1

      When I worked in accounting, I once designed the ideal file cabinet. Each drawer had a slot in the bottom, at the rear. A light spring would push all the file folders towards the front. Folders would routinely be replaced in the front of the drawer. When full, adding a new folder would push the the least used folder over the slot, where it would fall into a shredder. Never did get around to building one, much less patenting it . . .

  35. dont forget .. by Anonymous Coward · · Score: 0

    decay, dissolution, hallucination, masturbation, constipation, decomposition

    ashes to ashes dust to dust,
    we all know major Tom's a junkie,

    did any body answer the jack off comment above??
    perhaps a bit more relevant considering the subject material discussed here.
         

  36. Re:Ob msft by Anonymous Coward · · Score: 1

    "We don't. We declare chaos as the standard."

  37. Vendor Sort by Anonymous Coward · · Score: 0

    Just outsource it...

  38. Huffing dead Yoda's blanket fumes by Anonymous Coward · · Score: 0

    Yoda's cave philosophy.

    Keep it secret.
    Keep it safe.

    The way is shut.

    1. Re:Huffing dead Yoda's blanket fumes by Anonymous Coward · · Score: 0

      Keep it secret.
      Keep it safe.

      That was Gandalf's ring algorithm.

    2. Re:Huffing dead Yoda's blanket fumes by John.Banister · · Score: 1

      The way is shut.

      These documents were made by those who are dead.
      The dead keep their order,
      And none may these sort save those who are dead.
      The way is shut.



      The algorithm that can be named is not the eternal algorithm.

  39. I do not have physical things that need sorting by jopet · · Score: 1

    paper? you are kidding, right?

    1. Re:I do not have physical things that need sorting by Anonymous Coward · · Score: 0

      A binder's worth of old patient records, to be sorted by project number. (Which was luckily well marked in a corner).
      I did quicksort, just to try. It worked surprisingly well even with the physical aspect.

  40. Sorting papers or anything? by MindPrison · · Score: 1

    Sorting receipts, is like sorting anything else out there. So...how do I sort my VAST amounts of Electronic components?

    I name them, and I have individual shelves for them, not necessarily in alphabetical order, but more like groups...like those I'd need for certain purposes. Like...Coils in one section (a matrix/row of various values) and resistors in a increasing value row...like 1 ohm to 20 Mega Ohm. etc. And Capacitors...etc...you get the point. How do I file those? I don't... I just make sure that I've got enough stickers on them explaining what they are, where they are, and what they do...every single component...within eyes reach, so I can easily spot whatever I need for the next project.

    Well...you DID ask, and it didn't have to be OFFICE specific.

    --
    What this world is coming to - is for you and me to decide.
  41. Context-sensitive by gman003 · · Score: 2

    Sorting things alphabetically, as in the original example, I tend to start with a bucket sort, with the number of buckets depending on how many things I'm alphabetizing. This works well because I don't have to keep any state in memory other than what buckets there are (and if things are bad enough, I can do two stages of buckets - often mimicking a binary search in reverse, if there's a massive number). Once I've gotten everything at least first-letter alphabetized, I go through with a mergesort on each bucket, or if I'm able to hold all the documents or books at once, I just do an insertion sort.

    However, whenever I need to sort a deck of cards (to make sure it's a full deck, for instance), I just play a game of Klondike solitaire, cheating as needed. It's slower, sure, but more fun that way.

    1. Re:Context-sensitive by ImprovOmega · · Score: 1

      I agree, bucket sort is the easiest for me to implement. Especially if there's a large amount of items. Once it gets down to a smaller collection I typically implement a variation on bubblesort on the vastly smaller piles. Unless I know it's already nearly sorted (as with stacked bills, oldest on the bottom), then I do an insertion sort to get the small handful of out of order items into the right places.

  42. By first throwing out. by Anonymous Coward · · Score: 1

    A rough sort to throw out irrelevant debris reduces the whole task by 90%. It's a lot like code review: once you've thrown out all the useless legacy crap, mercilessly, what's left is a lot more useful and easier to understand.

    1. Re:By first throwing out. by hey! · · Score: 2

      Which fits with something which characterizes most effective sorting algorithms: they get rid of a lot of entropy early on. This works for tidying the house too. Start by throwing out stuff, then by moving things to the room they belong in, then putting them away.

      To answer the question, I tend to quick sort things into manageable unsorted piles, insertion sort the piles and reassemble the piles.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    2. Re:By first throwing out. by camperdave · · Score: 1

      A rough sort to throw out irrelevant debris reduces the whole task by 90%. It's a lot like code review: once you've thrown out all the useless legacy crap, mercilessly, what's left is a lot more useful and easier to understand.

      A rough sort to throw out irrelevant debris reduces the whole task by 90%. It's a lot like code review: once you've thrown out all the useless legacy crap, mercilessly, what's left is a lot easier to rewrite from scratch.
      FTFY

      --
      When our name is on the back of your car, we're behind you all the way!
  43. Insertion Sort by bussdriver · · Score: 1

    Books on a shelf. A loose binary search then a linear search for a tiny subset of 3-4 books and finally insertion of the book.

    I suppose you could call it a hash table- where the whole book is hashed down into a short string... called the TITLE...

  44. Physically? by geminidomino · · Score: 3, Funny

    When I'm sorting things in meatspace, I use a heap sort.

    I throw all the shit into a heap, then pick out the good bits.

  45. I am simply to lazy by Anonymous Coward · · Score: 0

    If it isn't for anything important, I usually just do a bubblesort as it is such an easy algorithm and call it a day.

  46. Heapsort by Anonymous Coward · · Score: 0

    The one true sorting algorithm.

  47. Insertion sort by Anonymous Coward · · Score: 0

    and nothing else, for this kind of thing.

  48. Combination Insertion and Merge by zmaragdus · · Score: 1

    With the jazz band I play in, we have a book full of a few hundred charts. When resorting them after a gig, I typically grab a small stack, sort it insertion style, set it aside, then do the same to another pile. Once a few piles have been done, they get merge sorted into a big pile. Big piles themselves are merge sorted, until all of my music is in order.

    --
    (((dB)))
    1. Re:Combination Insertion and Merge by zippthorne · · Score: 1

      I think that that is also how perl does it.

      --
      Can you be Even More Awesome?!
  49. Balloon Sort by Anonymous Coward · · Score: 1

    I use Balloon Sort.

    That's when I pick up each document, and attach it to a balloon filled with a specified amount of helium based on either date or alphanumeric index. Then I let it go.

    Voila! By the time I reach the last paper, they have all naturally sorted themselves vertically!

  50. This is how I sort: by Nyder · · Score: 1

    One at a time.

    --
    Be seeing you...
  51. Now that I think about it by fustakrakich · · Score: 1
    --
    “He’s not deformed, he’s just drunk!”
  52. bubble sort by Anonymous Coward · · Score: 0

    Bubble sort. 'cause it's the best!

  53. My prefered sort... by mindwhip · · Score: 0

    These are the steps I use to sort stuff...
    1. Extract hard drive from computer that needs sorting.
    2. Insert it into working Linux system and copy all user files that need to be kept to a directory
    3. Reinstall the hard drive back into the non booting computer
    4. Reinstall windows on the broken computer (or use the factory reset if it has one)
    5. Transfer the needed files via a samba share to the now sorted computer.
    6. Snoop through my co-workers files and post the funny ones on the internet. (optional)
    7. Collect reward, and bask in the glory of being called a miracle worker and saving all those (interchangeable) photos of co-worker children etc while giving (pointless) lecture on making backups.

    There are variants of this that involve using live CDs and USB drives or only doing step 4 but these can cause unwanted complications that I prefer to avoid and often result in skipping some or all of step 7.

    --
    [The Universe] has gone offline.
  54. In practice... by TsuruchiBrian · · Score: 1

    If I were sorting something alphabetically, I would do radix sort to sort everything by letter, then I do insertion sort on each pile.

    I studied computer science too, but I think the overhead of doing a sort with better time complexity actually is a significant hindrance for me to actually use it in practice. I'm never going to sort more than like a hundred things (because I'm lazy), and a computer is never going to take longer than a second to sort a million things. So it makes sense for me to use the sort with lowest overhead and for a computer to use a sort with the best time complexity.

    That said, I might do a merge sort the next time I have to sort something just to make it more entertaining.

  55. Internsort by Anonymous Coward · · Score: 0

    Find the lowest paid person in the office and have them sort it for me. If they want to use some fancy sorting algorithm they learned in college, they can knock themselves out.

  56. I don't sort by Nova+Express · · Score: 1

    Mainly because I'm out of sorts...

    --
    Lawrence Person (lawrencepersonh@gmailh.com (remove all "h"s to mail)

    http://www.lawrenceperson.com/

  57. Re:Ob msft by FatdogHaiku · · Score: 1

    "We don't. We declare chaos as the standard."

    I agree, as long as you wash on cold sorting should not be an issue.

    --
    You have the right to remain sentient. If you give up the right to remain sentient, you will be elected to public office
  58. Fond memories by istartedi · · Score: 1

    Fond memories of bucket-sorting (I always called it bin sorting) on temp jobs in the early 90s. The early 90s had a lot of paper-to-digital temp jobs like that. It was an OK way to pick up cash when "real jobs" were hard to find. Entering insurance claims from paper forms was probably the most interesting. The last time I did anything like this was business reply cards in 2004. That one came off Craigslist. Gigs like that have to be getting few and far between since everybody has a device now. BTW, if you put a joke address on a business-reply card it actually brightens the otherwise boring day of the data entry clerk.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    1. Re:Fond memories by carnivore302 · · Score: 1

      I'll bite. What joke address was it?

      --
      Please login to access my lawn
    2. Re:Fond memories by istartedi · · Score: 1

      Nothing particular that I remember. Nothing particularly ingenious--just your standard sexual or scatalogical humor. Sometimes they'd draw a penis on the card or something.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  59. Radix sort well fits human skills by Alsee · · Score: 1

    I've got some experience sorting huge stacks of pages. You basically want to maximize the work done per trivial-human-step. If you stick with some algorithm based on binary-comparisons you're missing out on some of the work a brain can do essentially for free.

    If you're sorting based on a number, it's a pretty quick easy step to drop the current paper in one of ten piles. If you're sorting by alphabetical then you can do one pass 26 piles (bulky but workable) or two pass (first pass A-F, G-M, N-S, T-Z, second pass sort into individual letters). This provides you with more than one bit-comparison of sorting per action. If you're sorting by date then year, month, first-digit-day, second-digit-day make excellent radix values.

    Merge sort isn't bad, but it's probably less efficient. If you work with two-stack merge you're only getting one bit of work per step. If you work with more than two stacks you have to scan the tops of the stacks to figure out which page to pick up. Contrast this with radix sort - it's quicker/easier to look at one page and drop it in one of N piles than it is to scan N piles to find which one to pick up.

    I see a lot of people mentioning bubble sort and related sorts, but I doubt those people ever had to deal with a few hundred pages. Those sorts are O(N^2), inherently worse. And shuffling the order of pages in a stack is a much messier and slower physical operation than simply dropping pages on the top of stack.

    All the other sorting algorithms I can think of seem to suffer from smaller work per step and/or messy physical manipulation. I'm open to other suggestions, but Radix sort seems to be best suited to human work. I had great success with it.

    -

    --
    - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
    1. Re:Radix sort well fits human skills by AlejoHausner · · Score: 1

      Strictly speaking, this is most-significant-digit-first radix sort. Alejo

  60. Random sort... by Parker+Lewis · · Score: 1

    Keep it putting elements in a random order until the correct order appears.

  61. Magic The Gathering sorting by GLOACAI · · Score: 1

    For MTG Cards I use a few sorting methods.

    The goal is to have them split up so that the colors are in their individual bins; each of those bins are sub-binned as either creatures, enchantments, or sorceries/instants/interrupts; and then all cards are alphabetized within each of the sub-bins. Multi-colored cards I don't bother with the sub-binning but instead alphabetize them after the color binning because there are a lot less of them.

    For the initial color binning I use a few runs of quick sort.

    A single run of quick sort to divide them into the sub-bins of creatures, enchantments or sorceries/instants/interrupts. (Damn Theros trying to throw a wrench into my plan, I finally decided to simply treat the Enchantment Creatures as enchantments because that was the first word)

    For alphabetizing the cards I start with a binary tree on the first letter of the card to bin them and then I use insertion sort on each bin. I intentionally start with the tree with a card whose first letter is around the middle of the alphabet. Next a recursive tree tracing algorithm to put the bins back together in order. Finally an "insertion sort" of these now sorted new cards into my already sorted old cards.

    That first insertion sort could probably be replaced by a more efficient algorithm but after all the binning the largest bin is usually no more than 30 cards. The next "insertion sort" is really something else I forgot the name of but the thing is I'm running it on two already presorted arrays so the indexes into both arrays only need to keep growing and make single pass of each array to put the cards away.

    When I get a couple of booster boxes per release and want them split up and alphabetized as described above definitely need a sorting algorithm.

    1. Re:Magic The Gathering sorting by Anonymous Coward · · Score: 0

      Nerdgasm!

    2. Re:Magic The Gathering sorting by Anonymous Coward · · Score: 0

      That is pretty much the same way I do it. The difference in my approach is, that I sort the rarity before the alphabetical sort, because uncommon and rare cards usually have the better mana ratio, or allow the combos to build decks around.

  62. Quicksort, switching to insertion sort by Anonymous Coward · · Score: 0

    I use a heuristic to pick the pivot for quicksort. Quicksort is great because you only have to work on two piles at a time. Once I'm down to a pile of 6-8 or so, I'll just insertion sort them.

    You can actually split into more than 2 buckets for the first round, but I find this slows me down a lot. Having to remember "A-L over here versus M-Z over there" is a lot easier than trying to keep straight "A-F there, G-L there, M-R there, S-Z there".

    However, for enormous piles (many hundreds to thousands of pages) that can be radix-sorted, that's usually a much better method.

  63. Sheetsort by Anonymous Coward · · Score: 1

    I had a professor in college (Rensselaer Polytechnic InstItute) who would lay all of his papers and work on a desk. At a point in the year (I can't remember if it was end of calendar or school year) he would just place a sheet over his desk, covering it. The sheet was labelled in the corner with the year. If he needed anything from previous years, he would just lift up the corners of the sheet to the right year and start looking.

    His desk was a solid foot thick with papers and sheets.

    Jdj

    1. Re:Sheetsort by camperdave · · Score: 1

      Ah! Kind of like Chinese tablecloth garbage collection, but in reverse.

      --
      When our name is on the back of your car, we're behind you all the way!
  64. How do I sort? Well... by Anonymous Coward · · Score: 0

    Like a boss!

  65. Garbage Truck. by Dan541 · · Score: 1

    The garbage truck sorts my paperwork for me.

    --
    An SQL query goes to a bar, walks up to a table and asks, "Mind if I join you?"
  66. To make life simple by Marginal+Coward · · Score: 1

    I always use insertion sort. Oh, except when I'm being dealt cards. Then I use quicksort.

  67. Merge sort is my choice by brausch · · Score: 1

    although radix is a close second. Depends on the mess I'm dealing with at the time.

    --
    "Almost every wise saying has an opposite one, no less wise, to balance it." - George Santayana
  68. half-bucket sort, runs in N time by raymorris · · Score: 1

    For things like receipts, I use a half-bucket sort, which runs in N time.
    There are 12 piles, one for each month. Items from the first half of the year go on the bottom of the pile, items from the second half go on the top of the pile. That of course means that physically there are 12 stacks, but logically there are 24 buckets - early January, late January, early February, late February, etc.

    The next step is - nothing. For receipts, sorting into 24 buckets is close enough that I'll be able to find what I'm looking for later.

    1. Re:half-bucket sort, runs in N time by holophrastic · · Score: 1

      damn, no mod points. mod up please.

  69. Solitaire by Anonymous Coward · · Score: 0

    Yea, having a sort-All is pretty handy. However, playing solitaire with the dates of your documents will provide a mistake-proof and certain way to get your documents in order. I saw a good demonstration by Persi Diaconis on Yo9u Tube.

  70. sonsort by Longjmp · · Score: 1

    This is slashdot, ok, so I'm not surprised no one came up with sunsort
    list sonsort( list ) {
    static father me;
    return me->son("sort!",list);
    }

    --
    There are fewer illiterates than people who can't read.
  71. sorting by BartlebyScrivener · · Score: 1

    I sort by time

    ls -lt

  72. Quicksort by ObsessiveMathsFreak · · Score: 1

    I actually sorted a large stack of numbered papers using quicksort. I chose it because it seemed to work well in the case of slow to move/compare paper.

    You pick the pivot, initially at random but with re-selections based on the knowledge of the total set. After that, you can step through the whole stack in a fairly automatic way, paper by paper, easily putting papers into the left/right stacks by just shifting them left and right. No slow paper by paper insertions or other checks. Just a paper by paper step through to divide the pile (hopefully) into two; lower-lower-greater-lower-greater-etc-etc

    I repeated the operation on the sub-stacks until they were at about ~5-10 papers. At this point I'd like to say I insertion sorted, but really I just shuffled them into position. And at the end, once all substacks are sorted, you just place them on top of one another and you're done.

    The biggest problem I had was moving the substacks around and finding space for them once their numbers started getting larger. I would consider this the biggest bottleneck in the method.

    Overall the operation seemed to work well considering the additional difficulty of actually physically moving the paper around by hand. But if someone reckons there was a better method I for one would be interested in hearing it.

    --
    May the Maths Be with you!
  73. Bucket sort by holophrastic · · Score: 1

    always a bucket sort. but they don't teach those in CS courses.

  74. Sorting by bin? by spasm · · Score: 1

    A slightly different question: how do you optimize 'bins' to sort things into? There's a pile of paper on your desk, some of it clearly belongs to one of the multiple projects you're working on, but some belongs to multiple projects. Some are in the pile because they seemed "interesting" or "revelant" in some way to things you're thinking about, but not in ways that are clear or straightforward.

    How do you take a random pile of paper and *quickly* come up with the smallest set of categories with at least one member which will encompass everything in the pile?

    1. Re:Sorting by bin? by camperdave · · Score: 1

      You could use Paper Tiger. It is an online indexing system. You would simply tag the paper's index with whatever projects or categories it belongs to, and then file the paper.

      --
      When our name is on the back of your car, we're behind you all the way!
  75. How do real men sort? by Anonymous Coward · · Score: 0

    Just like this

    1. Re:How do real men sort? by Anonymous Coward · · Score: 0

      Thank you!! THIS is what YouTube is for, not keyboard cats! :)

  76. Box Stapler by eric31415927 · · Score: 1

    However you sort, make sure you staple them to keep your receipts in order.
    This is particularly important if you subsequently enter them into an accounting program or even a spreadsheet.

  77. Approved system by Anonymous Coward · · Score: 0

    And if you use an IRS approved system you don't even need to keep the originals. Just be damned sure you've got backups in case something happens.

  78. huh? by the_Bionic_lemming · · Score: 1

    People get confused when sorting receipts by date?

    Please, for the love of just pull a darwin.

    I'll send the chlorine to help the gene pool.

    --
    _ _ _ Go for the eyes Boo! GO FOR THE EYES!
  79. Don't sort. Index by Anonymous Coward · · Score: 0

    I don't actually sort them. I just tag them all 0 through n.
    Then I create indexes.

  80. Size of the desk by Anonymous Coward · · Score: 0

    It depends on the size of the available desk space.

  81. What sort? by chrismcb · · Score: 1

    How were you originally sorting? Were you partitioning the receipts into separate piles, based on some date? And then taking each pile and sorting them? How is this NOT one of those fancy sorting algorithms you learned in comp sci? And how was a radix search faster?

  82. Insertion + Merge by neonleonb · · Score: 1

    First, I construct medium-size piles via insertion sort. That works great as long as there are few enough things that I can spread them all out and see where to insert new ones. Once that gets crowded, I stack that into a pile and put it aside. Repeat until every document is in a sorted stack.

    Then I merge-sort the stacks.

    All in all, I find it a reasonably efficient method.

  83. Intern.Sort(List) by malacandrian · · Score: 1

    I just pass the list to the intern helper-object, and let the environment deal with the implementation.

  84. sorting socks by Anonymous Coward · · Score: 0

    It's easy to apply formal sort algorithms to things that are easy to compare.

    Lacking an appropriate comparator, I always fail to sort socks in a reasonable time. Any tips?

    1. Re:sorting socks by Anonymous Coward · · Score: 0

      Number of holes ?

  85. But seriously... by Mike+Van+Pelt · · Score: 1

    Every now and then, I need to sort a stack of a few dozen numbered envelopes in numerical order. The first two digits are the same (year) and the last two digits go up to 70-something.

    I once used quicksort, but found it too cumbersome for the task at hand.

    What I do now is just deal them into piles by the second digit. Each stack is small enough that it's easy to just eyeball-sort them, starting with the 0 stack and ending at the 7 stack.

  86. Human-aided computer sort by ajyand · · Score: 1

    The method I commonly use is human-aided computer sort. This is how it works. You hand over the sixty or something papers to 60 people while entering the sortable field of each paper in a spreadsheet as you do it. Sort the field on the spreadsheet and collect the sheets back from the fellas in the sorted order. As a bonus you get the soft copy of the entire index. And it only takes O(n).

  87. Depends on the place I got by Anonymous Coward · · Score: 0

    If I got a lot of place, I separate in category , the bubble sort. Otehrwise I bubble sort from the start. No , really. I reserve radix sort or qsort to my programs.

  88. unordered heap by Anonymous Coward · · Score: 0

    i perfer the 'unordered heap' data structure. Just create pointers to the elements in the heap and sort the pointer any way you want.

  89. The most important question... by FaxeTheCat · · Score: 1

    ...does sorting give any benefit in the long run?
    I keep all my receipts (and bank statements etc...) in a binder without sorting them. One binder per year (sort of).
    If/when I need one of the receipts, I simply look through the binder for the relevant year (s). Time spent per search is a fracion of the time I would need to sort them.
    As I usually do not know the date of the receipt when I start looking, sorting by date would not provide a benefit anyway.

  90. Easy. by grep+-v+'.*'+* · · Score: 1

    . So, when you have to physically sort things, what algorithm (if any) do you use?"

    The pitchsort algorithm AKA a bonfire. Works even better in winter!

    Of I just toss it if it's a bill. They'll send another...

    --
    If the universe is someone's simulation -- does that mean the stars are just stuck pixels?
  91. Perry Mason sort. by 140Mandak262Jamuna · · Score: 1
    Perry Mason: "Someone rented a car, returned it and rented it again. We need to find that person."

    Paul Drake: "Do you know his name?"

    Perry Mason: "No"

    Paul Drake: "Do you really want me to take all these receipts and compare each against everything else? Do you know how long will it take, Perry?

    Perry Mason: "Paul, Just sort these receipts by name and look for duplicates"

    Donald Knuth, quoting Erle Stanley Gardener, in the chapter on sorting in the TeX book.

    [Quoting from memory, please forgive inaccuracies].

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  92. 52-pick-up by tverbeek · · Score: 1

    I use the 52-pick-up sort

    --
    http://alternatives.rzero.com/
  93. Shuffle sort into a linear merge by scorp1us · · Score: 1

    If you remember, the O(N^2) shuffe sort is fastest on piles n =6 So I. make sorted piles of 6. These sorted piles of 6 are done using the brains only internal intutitve sort. Then you linear sort the piles of 6 together. I try to go for as many piles at the same time, not just 2. If fact this is more limited by distance than anything else. Since you are sorting things with a physical representation you need to take the time cost of moving yourself into account. With a deck of cards, there is no move costs but with dozens of 8x11 or A4 papers, reach becomes a factor.

    I've been doing this since 2001 and I have yet to find a better way.

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
  94. AndySort by Vyse+of+Arcadia · · Score: 1

    I sort things into what's known as a stack, or a pile, and then I put them in the freezer.

  95. Sorting exams by Anonymous Coward · · Score: 0

    Teacher here. I often have to sort stacks of 20-40 exams, and I use a two step-method. First, I radix-sort the exams in five stacks, e.g. A-C, D-G, H-M, N-R, S-Z, and then I spread out each stack and sort it using selection sort (this goes very quickly since each stack has around 6 exams in it).

    I tried fancy algorithms such as merge sort and quicksort, but for physical sorting of a small number of exams, the method above is quicker.

  96. O(n*n) Insertion sort by allo · · Score: 1

    Grab a paper, go through the already sorted papers and put it at the right place. Its n*(n/2) (approximately), because i do no binary search, but search from top/bottom whats more likely to be the shorter way (with some intuition about the already inserted papers). So its O(n)

    1. Re:O(n*n) Insertion sort by allo · · Score: 1

      O(n^2). Slashdot breaks superscript. Maybe finally a feature, the beta could fix.

  97. Clock Sort. by Anonymous Coward · · Score: 0

    Year has 12 months.
    (Standard) wall clock has 12 hours.
    I sit in the center with the pile in front of me and sort the months onto stacks based on the hour. (12 in front of me, 3 to my right, etc.) After a few minutes, you don't need to look at the stacks. I don't bother secondary sorting within each month, so it's O(n).
    If I'm looking at receipts against statements, when I go through a month a few receipts will inevitably need to progress forward to the next pile. (Receipts from the past show up on statements in the future, but not the other way around.)

  98. Shameless plug by ssufficool · · Score: 1

    Scan and sort using http://www.neat.com/products/n... I've seen it on TV, it must be good right?

  99. Bridge players use insertion sort by Anonymous Coward · · Score: 0

    This is something that duplicate bridge players do about 25 times a session . We use insertion sort.

    When a player picks up a hand, it is typically shuffled, but players prefer to have cards separated by suits and descending order within each suit. Most people pick up their 13 cards and then move individual cards around using insertion sort. It is quite intuitive and relatively quick. However, insertion sort has a few other bridge-specific advantages: often players can evaluate their hand even as they are sorting it by first moving the high cards in place. Also, it is not necessary to completely sort the hand -- spot cards can be in any order and you will often find players sorting the spot cards before they put down as dummy.

    I suppose the complete answer would be that humans use insertion sort to result in a partially sorted hand.

    As an aside, all-time great bridge player Bob Hamman does not sort his hand. Just as moderately skilled bridge players do not sort the "spot cards" because they can figure those out on the fly, Bob Hamman can visualize and remember the entire hand without needing to sort it.

  100. Bridge players use insertion sort by lakshmanok · · Score: 1

    This is something that duplicate bridge players do about 25 times a session . We use insertion sort. When a player picks up a hand, it is typically shuffled, but players prefer to have cards separated by suits and descending order within each suit. Most people pick up their 13 cards and then move individual cards around using insertion sort. It is quite intuitive and relatively quick. However, insertion sort has a few other bridge-specific advantages: often players can evaluate their hand even as they are sorting it by first moving the high cards in place. Also, it is not necessary to completely sort the hand -- spot cards can be in any order and you will often find players sorting the spot cards before they put down as dummy. I suppose the complete answer would be that humans use insertion sort to result in a partially sorted hand. As an aside, all-time great bridge player Bob Hamman does not sort his hand. Just as moderately skilled bridge players do not sort the "spot cards" because they can figure those out on the fly, Bob Hamman can visualize and remember the entire hand without needing to sort it.

  101. multiple methods, knowing or not by xgeorgio · · Score: 1

    From smaller to larger data volumes, humans tend to employ:

    20 items: selection (direct) sort
    20-50 items: something like bubblesort or multiple splits, e.g. quicksort-like
    50-500 items: definately heapsort, mergesort (without knowing it)
    500+ items: just give up, or do it as a hobby over the holidays...

    --
    "Abashed the Devil stood, and felt how awful goodness is..."
  102. DumpsterSort by Anonymous Coward · · Score: 0

    I find DumpsterSort to be the quickest and most efficient for my boxes of old papers.

  103. there are two types of people...... by gzuckier · · Score: 1

    One type sort their stuff..
    The other type leave the piles as is and index mentally. Most people have had the experience of being in somebody's incredibly cluttered workshop/office/kitchen and the person is able to just conjure up mentally where the thing he/she needs is and go directly there.

    --
    Star Trek transporters are just 3d printers.
  104. MtG sort by Draugo · · Score: 1

    While sorting through my MtG cards I usually start by sorting by color (easiest to notice), then I sort each pile by expansion. These two can go straight to their own piles. After that I sort within expansion by forming two piles, one with cards from A-N and second from O-Z (this point being the natural split for alphabets in my mind). Finally depending on the size of the remaining pile I either do an optimized bubble sort in my hand or continue splitting until I reach a point where bubble sort is easy enough to handle (no pun intended). This method I've found the easies to visualize and it provied many easy breakpoints when I get sick of sorting more cards.

  105. Perfect solution by Neil+Boekend · · Score: 1

    I let the program import the sortable items in MS excel and sort them there.

    --
    Well, I might have a way, but it only works on a semi spherical planet in a vacuum.
  106. Merge sort by GuB-42 · · Score: 1

    Most teachers I knew naturally used a variant of merge sort when sorting a pile of test papers. Most didn't know anything about formal sorting algorithms.