Spiked Math Games  // Math Fail Blog  // Gauss Facts  // Spiked Math Comics

# 320

Math Halloween Costume Idea 1 - October 17, 2010
• Currently 4.6/5
• 1
• 2
• 3
• 4
• 5

Nice one

Site Checking

Hmm... Should be okay now.

Hahahahaha!! This one awesome.. ROFL.

kid with candy nearest to the one you stole candy from...
couldn't that be interpreted as the one you just stole from [if there's any candy left] since the distance from him to him would be 0?

Well, yes. The "if there's any candy left" is key. The greedy algorithm leaves no candy (and if the kids gets more candy and is still the closest... rob him again).

don't know about yours, but my friends would probably stop talking to me if I stole all their candy... then again, i could make new friends, but at the cost of some of my candy... :( its a sad, sad world we live in; a world where no man can keep his friends and have all their candy at the same time...

Greedy Algorithm: good for making change, bad for making friends

Halloween is for the needy not the greedy :P... Now I NEED all those candies ;)

This is far from optimal. You can create examples which are as bad as you want. Imagine a graph of kids (that have each only one candy bar) that lead you away from a kid with an arbitrary amount of candy, which would just be an infinitesimally small distance further away.

But of course, nobody says that greedy is always the best (in fact it is usually not). Nonetheless, you should define the metric by which you measure how well you perform (is it amount of candy by total distance?).

"Better" Algorithm: Everyone walk to me and give me your candy. O(1) for parallel servers.

I think my professor wrote a paper on how to find a approximation for this...

(Note: You must have javascript enabled to leave comments, otherwise you will get a comment submission error.)
If you make a mistake or the comment doesn't show up properly, email me and I'll gladly fix it :-).

Welcome to Spiked Math!

Hello my fellow math geeks. My name is Mike and I am the creator of Spiked Math Comics, a math comic dedicated to humor, educate and entertain the geek in you. Beware though, there might be some math involved :D

New to Spiked Math?
View the top comics.

New Feature: Browse the archives in quick view! Choose from a black, white or grey background.

Other Math Comics