The Elegant Algorithm

I like to think about ways of doing things.

If only I could teach our new puppy to put his own toys away. Wouldn't that be convenient?

Okay Douglas (our Yorkshire's name), here's the water and soap to wash your dishes and when you're done, ah yeah ah, pick up your toys in the living room and put them away.

This is highly unlikely seeing he can't even hold his bladder when I come home from work and other things must be "picked up". Someone else must pick up the toys. But how?

Well, counting from one to the number of toys, picking a toy up and putting it away at each number is a possibility. But that seems problematic. What if the total number of toys is not known or worse yet, the total number of toys that need to be put away is not obvious? Well, I can see four, but maybe there's one behind the sofa I can't see.

I have an idea; Let's just start picking up toys. Pick one up, put it away and find the next one, that's what we'll do! But we have another issue. What if all the toys have already been put away or no toys were ever brought out?

Then our only option is while we're able to find a toy that has not been put away, get it and put it away.

These are things I like to think about.

Kerry Millen