Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!

Ask Slashdot: How Do You Sort?

Soulskill posted about 9 months ago | from the sort-of-slowly dept.

Math 195

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?"

Sorry! There are no comments related to the filter you selected.

Ob xkcd (5, Funny)

Geoffrey.landis (926948) | about 9 months ago | (#46378009)

The obligatory xkcd [xkcd.com]

Re:Ob xkcd (1)

phrostie (121428) | about 9 months ago | (#46378077)

Tiny bubbles

in the Wine.org

Re:Ob msft (1)

Anonymous Coward | about 9 months ago | (#46378255)

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

Re:Ob msft (1)

FatdogHaiku (978357) | about 9 months ago | (#46378667)

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

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

fuck you, geoffrey.landshit (-1)

Anonymous Coward | about 9 months ago | (#46378957)

Shut up faggot. Don't have anything original? Or is it teh ebil kopywrights that are preventing you from creating so you just steal like a faggot steals shit from another faggot's asshole with his tongue?

Bogosort (0)

Anonymous Coward | about 9 months ago | (#46378023)

Bogosort, of course. I'm only human.

Bucket sort or bin sort (2, Funny)

Anonymous Coward | about 9 months ago | (#46378025)

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

Re:Bucket sort or bin sort (0)

Anonymous Coward | about 9 months ago | (#46378895)

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.

Bubble sort (3, Insightful)

Anonymous Coward | about 9 months ago | (#46378027)

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.

Re: Bubble sort (1)

pollarda (632730) | about 9 months ago | (#46378105)

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!

Get Out (-1)

Anonymous Coward | about 9 months ago | (#46378147)

If I were your boss, I'd fire your ass for wasting time. File the damned receipts in order as you get them.

Holy Crap what a useless POS you must be at work.

I think this paralells the jerkoff coment below (0)

Anonymous Coward | about 9 months ago | (#46378207)

I think this paralells the jerkoff coment below

Yes - the Pile sort... (4, Funny)

NotQuiteReal (608241) | about 9 months ago | (#46378227)

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.

Re:Bubble sort (2)

Black LED (1957016) | about 9 months ago | (#46378521)

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.

merge sort (1)

Anonymous Coward | about 9 months ago | (#46378031)

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

Bogosort (4, Funny)

igny (716218) | about 9 months ago | (#46378035)

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

Balloon Sort (1)

Anonymous Coward | about 9 months ago | (#46378443)

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!

Shredsort (5, Funny)

Anonymous Coward | about 9 months ago | (#46378049)

I find Shredsort to be the fastest.

Re:Shredsort (5, Funny)

Anonymous Coward | about 9 months ago | (#46378141)

Hmm, that's O(n).

Trashsort is O(1)

Re:Shredsort (2, Funny)

ClickOnThis (137803) | about 9 months ago | (#46378201)

Hmm, that's O(n).

Trashsort is O(1)

But IdentityTheftSort is O(n!).

Re:Shredsort (2)

NotQuiteReal (608241) | about 9 months ago | (#46378391)

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.

Re:Shredsort (2, Funny)

Anonymous Coward | about 9 months ago | (#46378505)

> But IdentityTheftSort is O(n!).

I thought it was O(noes!) ?

Re:Shredsort (1)

iced_773 (857608) | about 9 months ago | (#46378283)

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

Re:Shredsort (0)

Anonymous Coward | about 9 months ago | (#46378511)

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.

Ditto. (1)

pla (258480) | about 9 months ago | (#46378055)

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.

Re:Ditto. (0)

Anonymous Coward | about 9 months ago | (#46378113)

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.

GPUs (0)

jones_supa (887896) | about 9 months ago | (#46378061)

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.

Re:GPUs (4, Funny)

K. S. Kyosuke (729550) | about 9 months ago | (#46378089)

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.

Re:GPUs (2)

ja (14684) | about 9 months ago | (#46378101)

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

Re:GPUs (1)

TeknoHog (164938) | about 9 months ago | (#46378211)

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... [wikipedia.org]

Re:GPUs (3, Interesting)

mikael (484) | about 9 months ago | (#46378343)

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... [wikipedia.org]

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.

I'd say heapsort (1)

BabaChazz (917957) | about 9 months ago | (#46378063)

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.

Elementary operations (0)

Anonymous Coward | about 9 months ago | (#46378073)

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.

Re:Elementary operations (1)

K. S. Kyosuke (729550) | about 9 months ago | (#46378129)

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.

Re:Elementary operations (1)

MickLinux (579158) | about 9 months ago | (#46378273)

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.

The Ignatius P. Reilly System (2)

l0ungeb0y (442022) | about 9 months ago | (#46378075)

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.

Re:The Ignatius P. Reilly System (1)

lazy genes (741633) | about 9 months ago | (#46378705)

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

hey slashdot. since this forum has degraded to cra (-1, Offtopic)

Anonymous Coward | about 9 months ago | (#46378079)

how do I jerk off most effectively??
up and down, left or right?
KY, gun grease, goose juice, Zogs Sex wax?

after completion, what is the most effective way to dispose of the waste by products once expulsion is complete?

I am reaching out to the community for a meaningful response to my serious delima.

Hmm, chicken grease works good too and it smells l (1)

Anonymous Coward | about 9 months ago | (#46378093)

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

Re:Hmm, chicken grease works good too and it smell (0)

Anonymous Coward | about 9 months ago | (#46378127)

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...

Re:Hmm, chicken grease works good too and it smell (1)

Anonymous Coward | about 9 months ago | (#46378169)

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 :)

Re:hey slashdot. since this forum has degraded to (1)

Anonymous Coward | about 9 months ago | (#46378187)

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"??

 

(Parallel) Radix Sort (0)

Anonymous Coward | about 9 months ago | (#46378095)

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

Out performs everything else when N is large.

Radix sort (1)

K. S. Kyosuke (729550) | about 9 months ago | (#46378097)

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.

i dont need no stinking sort (0)

Anonymous Coward | about 9 months ago | (#46378107)

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

dont forget .. (0)

Anonymous Coward | about 9 months ago | (#46378233)

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.
     

Usually by whites and colors. (1)

Oligonicella (659917) | about 9 months ago | (#46378109)

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

Re:Usually by whites and colors. (1)

Anonymous Coward | about 9 months ago | (#46378185)

Racist.

Re:Usually by whites and colors. (-1)

Anonymous Coward | about 9 months ago | (#46378225)

You're the racist, Jew.

Re:Usually by whites and colors. (0)

Anonymous Coward | about 9 months ago | (#46378265)

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.. ;)

 

How About SecretarySort? (1)

stevegee58 (1179505) | about 9 months ago | (#46378117)

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

How about Administrative Assistant sort? (2)

Above (100351) | about 9 months ago | (#46378131)

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.

the ultimate sort (1)

pixelateddwarf (1931396) | about 9 months ago | (#46378123)

With real physical sorts I pipe everything to DEV NULL

Re:the ultimate sort (0)

Anonymous Coward | about 9 months ago | (#46378403)

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....

Combined (0)

Anonymous Coward | about 9 months ago | (#46378135)

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.

Bucket sort followed by insertion sort (1)

Anonymous Coward | about 9 months ago | (#46378143)

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

Re:Bucket sort followed by insertion sort (1)

Waffle Iron (339739) | about 9 months ago | (#46378251)

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.

Give every page a number. (2)

leuk_he (194174) | about 9 months ago | (#46378151)

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.

Non-deterministic sort (4, Interesting)

kebes (861706) | about 9 months ago | (#46378157)

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.)

Re:Non-deterministic sort (0)

Anonymous Coward | about 9 months ago | (#46378939)

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

binary sorting (0)

Anonymous Coward | about 9 months ago | (#46378159)

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.

My method (5, Funny)

synaptik (125) | about 9 months ago | (#46378161)

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.)

merge or bin sort (1)

khallow (566160) | about 9 months ago | (#46378173)

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?

OldSpiceSort (1)

Anonymous Coward | about 9 months ago | (#46378221)

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

Two-pass bucket sort (3, Interesting)

JazzHarper (745403) | about 9 months ago | (#46378223)

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.

Re:Two-pass bucket sort (2)

Lehk228 (705449) | about 9 months ago | (#46378453)

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

Vendor Sort (0)

Anonymous Coward | about 9 months ago | (#46378279)

Just outsource it...

Huffing dead Yoda's blanket fumes (0)

Anonymous Coward | about 9 months ago | (#46378287)

Yoda's cave philosophy.

Keep it secret.
Keep it safe.

The way is shut.

Re:Huffing dead Yoda's blanket fumes (0)

Anonymous Coward | about 9 months ago | (#46378819)

Keep it secret.
Keep it safe.

That was Gandalf's ring algorithm.

I do not have physical things that need sorting (1)

jopet (538074) | about 9 months ago | (#46378291)

paper? you are kidding, right?

Insertion Sort (1)

bussdriver (620565) | about 9 months ago | (#46378349)

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...

Re:I do not have physical things that need sorting (0)

Anonymous Coward | about 9 months ago | (#46378717)

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.

And yet.. (-1)

Anonymous Coward | about 9 months ago | (#46378301)

Dice/. rejected MY question:

How do you all take a shit?

Sorting papers or anything? (1)

MindPrison (864299) | about 9 months ago | (#46378309)

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.

Context-sensitive (2)

gman003 (1693318) | about 9 months ago | (#46378329)

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.

By first throwing out. (1)

Anonymous Coward | about 9 months ago | (#46378331)

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.

Re:By first throwing out. (2)

hey! (33014) | about 9 months ago | (#46378571)

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.

Re:By first throwing out. (1)

camperdave (969942) | about 9 months ago | (#46378687)

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

Physically? (3, Funny)

geminidomino (614729) | about 9 months ago | (#46378355)

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.

I am simply to lazy (0)

Anonymous Coward | about 9 months ago | (#46378379)

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.

Heapsort (0)

Anonymous Coward | about 9 months ago | (#46378387)

The one true sorting algorithm.

Insertion sort (0)

Anonymous Coward | about 9 months ago | (#46378397)

and nothing else, for this kind of thing.

Combination Insertion and Merge (1)

zmaragdus (1686342) | about 9 months ago | (#46378401)

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.

This is how I sort: (1)

Nyder (754090) | about 9 months ago | (#46378489)

One at a time.

Now that I think about it (1)

fustakrakich (1673220) | about 9 months ago | (#46378493)

This might work [slashdot.org] ...

bubble sort (0)

Anonymous Coward | about 9 months ago | (#46378545)

Bubble sort. 'cause it's the best!

My prefered sort... (0)

mindwhip (894744) | about 9 months ago | (#46378587)

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.

In practice... (1)

TsuruchiBrian (2731979) | about 9 months ago | (#46378631)

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.

Internsort (0)

Anonymous Coward | about 9 months ago | (#46378645)

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.

I don't sort (1)

Nova Express (100383) | about 9 months ago | (#46378649)

Mainly because I'm out of sorts...

Fond memories (1)

istartedi (132515) | about 9 months ago | (#46378669)

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.

Radix sort well fits human skills (1)

Alsee (515537) | about 9 months ago | (#46378673)

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.

-

Random sort... (1)

Parker Lewis (999165) | about 9 months ago | (#46378691)

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

Magic The Gathering sorting (1)

GLOACAI (924331) | about 9 months ago | (#46378719)

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.

Re:Magic The Gathering sorting (0)

Anonymous Coward | about 9 months ago | (#46378921)

Nerdgasm!

Quicksort, switching to insertion sort (0)

Anonymous Coward | about 9 months ago | (#46378769)

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.

Sheetsort (1)

Anonymous Coward | about 9 months ago | (#46378855)

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

How do I sort? Well... (0)

Anonymous Coward | about 9 months ago | (#46378905)

Like a boss!

Garbage Truck. (1)

Dan541 (1032000) | about 9 months ago | (#46378911)

The garbage truck sorts my paperwork for me.

To make life simple (1)

Marginal Coward (3557951) | about 9 months ago | (#46378943)

I always use insertion sort. Oh, except when I'm being dealt cards. Then I use quicksort.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?