Week 2 Discussion Forum

Difference Between Good And Bad Algorithm

Difference Between Good And Bad Algorithm

by Alif Pranto -
Number of replies: 0

“An algorithm” is merely “a way of doing something” (the term doesn’t apply only to computer programming), so having a bad way of doing something isn’t as good as having a good way of doing it. Why? That depends on what you’re trying to accomplish and the “algorithms” you’re using.

For example, two algorithms for cutting the grass on your lawn are 1) using a riding mower and 2) using a cuticle scissor. If you don’t mind being on your knees, with your head close to the ground, for a few days, clipping one blade of grass at a time, the second way isn’t really “bad” - but the first way is probably better.

An algorithm for multiplying a number by 100 by adding it to itself 100 times isn’t as efficient as multiplying it by 100. (It’s also a lot more code the first way, and it takes a lot more time to write it - and gives you a lot more places in which to have a typo.)


168 words