It’s often funny, when I realize how many software algorithms are things we do naturally in every day life. I suspect that people do these things every day without realizing. Today’s blog post, I’m just writing a few down that I’ve noticed. Others have noticed the everyday patterns as well: http://1000awesomethings.com/2010/05/20/501-picking-the-fastest-moving-line-at-the-grocery-store-checkout/
When I was 6-year child, I came up with the obvious “find-mommy-in-the-supermarket” algorithm. Once I lost my mother, I would immediately find an edge/wall in the store. Then I would walk straight along the wall looking forward and to my side down aisles. If I completed two edges without finding my mom, I would continue along the next wall, since typically it meant a slight chance that my mother was between two aisles exactly at the moment I was sighting. Since she usually continued to shop i.e. move, I could be almost certain to find her on the next iteration.
- Assume: You are in an Aisle
- Start: Look behind and infront of you
- Find first edge/wall & corner of the store
- Traverse the edge of store looking at each aisle
- Sighting down the aisle,
- Sighting forward/back
- If you reach the far-corner without finding “mom”, turn the corner and go to #4.
Later in University while studying Computer Science, I lived in a campus dorm room overlooking an enormous parking lot. The early morning, weekday parking lot was almost completely empty. Between 9am and 10am it would fill completely in a simple stack-like manner. The later cars would add themselves to the very end of the parking lot furthest away from the buildings. But by 3pm, the pattern would start to reserve itself. The far end of the parking lot was completely full, but closer spots, some at the building entrances themselves, would be empty. Finally by 5pm, the lot would become heavily fragmented throughout.
Since it was a large lot, I could write a simple algorithm to optimize the combined walking/driving time of a driver.
- Before 9am, drive to the entrance of the buildings and park closest
- After 10am, drive towards the entrance of the buildings and park at the last empty spot
- After 3pm, begin a O(n) search of the lot, visiting each spot until you find a spot
- After 5pm, drive down one lane of the lot picking the closest spot you find to a building
- Evening, drive to the entrance of the buildings and park closest
I later noticed another pattern at meetings with larger audiences. Often times the back would fill with standing room only crowd, but the middle and front would be filled with scattered empty seats. Curious, has anyone ever noticed this as well? Did you ever notice how people tend to pick edges and back seats, preferring to stand rather than sit in the middle/front?