Here is a short and (hopefully) amusing story about a real-world implementation of bubble sort I have recently observed. Mind you these are non-computer types that do this, and miraculously it ends up pretty close (not exactly, but close) to a bubble sort. It is only approximate, but it is also quite fault tolerant.
Okay, here's the story. At the Chapter House (a bar that I go to for a pint from time to time), the tap room is layed out as follows: If you are facing the bar, at the far right of the room there is the entrance from the outside, which consists of a drafty old wooden door that doesn't quite seal, and a wall of old 1800's era windows that are also quite drafty. On the far left, there is a steam radiator that kicks out an impressive amount of heat. So, as you'd expect, it's cold and drafty at the side by the door, and warm and nice at the side by the radiator.
There exists a row of about 9 or 10 chairs that are the right height to sit on while at the bar. These chairs have seen better days, and some of them are so wobbley and rickety that they feel quite hazardous to sit in even when your world is on a completely even tilt, so you can imagine how people feel about them once they get a couple pints in them. There is a fairly even and continuous distribution among these chairs on a scale between completely falling apart and relatively sturdy.
Now comes the fun part. I was sitting there one day watching a newcomer settle in. Here are the steps that most people take when sitting down at the bar:
- Find the leftmost (warmest) unoccupied space at the bar
- Test the quality of the chair at that spot, as well as the chair at the next unoccupied spot to the right (the next warmest spot)
- If the chair at your spot is more sturdy, keep it. If not, most people simply swap their more rickety chair with the more sturdy one to the right.
This
fuzzy process occasionally is broken by somebody who doesn't care about chair quality, or temperature, or if there is a group of several sitting down such that they need to find a
contiguous block of several
chairs, but on the whole it is remarkably effective. Most of the winter (when the
temperature issue matters most), you will find the chairs pretty accurately sorted so the rickety chairs live down at the cold end of the bar, and the most solid chairs live at the warm end.
This is a real pisser if you come late, however, because then you get the cold seat, and a crummy chair to boot. Every once in a while they sweep the floors, and in doing to randomly reorganize the chairs, but within a day or so, they end up sorted again. It's quite amazing to watch.