- Published: Wednesday, 27 January 2016 08:23
What's a bubble sort you ask? or what's an eggplant maybe? Well, in this lovely tutorial you'll learn about both.
1. Eggplant, or aubergine, is an edible fruit with many varieties eaten all around the world, from Asia to Europe to the Americas. There are probably more preparations than varieties, which is what makes eggplants such a great pick at the super market.
2. A bubble sort is the most horribly inefficient method for a computer to sort and find data. It's the first way you learn how to search using an algorithm in computer programming. I'm sorry if I scared you by using the word "algorithm", it just means "instructions".
What do they have in common? Well if you're buying eggplant in the market, there are a few factors to look for. First, you're looking for firm and plump with little scarring or squishiness. Once you've got a few lookers in the bunch, you can pick the best one based on weight. This is where the bubble sort comes in.
Here's my method
- Identify 5 or 6 that are about the size that I want.
- Pick them up, one at a time (I use my left hand only, more on my choice of limbs later).
- Compare the weight of each one until I find the heaviest one. NOTE: this is compared to others of the same size.
- PUT IT IN THE CART
Here's why it works:
After reviewing a few blogs and recommendations from locals, I understand that the heaviest eggplant is the best. Now, obviously if I pick the largest it will be the heaviest, so I only focus on ones that are the same shape and proportions. I use my left hand because it is weaker than my right and I think it's more susceptible to weight differences. Whereas everything in my right hand feels pretty light.
That's a bubble sort, comparing each item in a set until you find the correct value. In this case, it's the tastiest eggplant. Congratulations, you're now a crappy programmer.
In short, for a computer, that's a terrible way to find information. Any coder worth his weight in keystrokes will tell you that there are more efficient ways to get the best one. In fact, they might all agree that dividing up every eggplant into two groups, weighing them all at once, picking the lighter pile, dividing it up, and weighing it again and again would be the most efficient way. When it comes to eggplants at the market, if you think that's your best option, I urge you to go ahead and try it. If you do, go ahead and email me the results!
Until then, I'll be cooking tasty eggplant Parmesan, ratatouille, sabich, and baba ganoush with my bubble sort.
Special thanks to my expert programmer friend/colleague Roy for giving me some useful insight :)