### Algorithms

The other day I had a conversation with

CB was talking (I think) about how long a TV season's worth of DVD's isif there are 24 episodes to a season that are 45 minutes long after the commercials are taken out. I did some mental math and told him it was 1080 minutes. He asked me how many hours that was. I did some more mental math, made a mistake, and gave him a wrong answer. An obviously wrong answer. Duh. I got it right on my second try though.

Then I realized that there was a better algorithm for computing how many hours are taken up by the 24 episodes. Instead of multiplying the number of minutes by 24 and dividing by 60, it would make more sense to multiply the number of hours (3/4) by 24 and skip the division.

Today when I gave my opening lecture I used this conversation as an example of how there can be more than one correct algorithm (or set of steps) to solve a problem. I left out the part about making a mistake though. They still have 5 weeks to learn how capable of error I am.

Thanks, crimsonbat. :)

**thecrimsonbat**that came in handy today when I gave my first lecture in my Design And Analysis Of Algorithms class.CB was talking (I think) about how long a TV season's worth of DVD's isif there are 24 episodes to a season that are 45 minutes long after the commercials are taken out. I did some mental math and told him it was 1080 minutes. He asked me how many hours that was. I did some more mental math, made a mistake, and gave him a wrong answer. An obviously wrong answer. Duh. I got it right on my second try though.

Then I realized that there was a better algorithm for computing how many hours are taken up by the 24 episodes. Instead of multiplying the number of minutes by 24 and dividing by 60, it would make more sense to multiply the number of hours (3/4) by 24 and skip the division.

Today when I gave my opening lecture I used this conversation as an example of how there can be more than one correct algorithm (or set of steps) to solve a problem. I left out the part about making a mistake though. They still have 5 weeks to learn how capable of error I am.

Thanks, crimsonbat. :)

thecrimsonbat