### DS & A (Algorithm Evaluation)

###
__| Algorithm Evaluation____ - CHAPTER 3____ |__

I am pretty sure that by this point most of you guys are familiar with the basic terms necessary for learning Data Structures and Algorithms. (If not you can check the previous chapters)

As I mentioned in the last post that an algorithm is an unambiguous series of concrete steps to solve a class of problems, which in simple language can be defined to be a method to solve a problem. But if it is a method to solve a problem, and since in most cases there exists more than one solution to a problem, doesn't that mean that there is more than one algorithm for a particular problem?

The answer is "yes", there is generally more than one algorithm for a particular problem. And that brings us to the topic of Algorithm Evaluation.

The answer is pretty simple, we need Algorithm Evaluation to find the best (or a reasonable and valid) algorithm by comparing the available algorithms for a particular problem.

Consider a scenario where you are about to prepare some coffee. And as we know there is no one single specific way to prepare coffee so we can come up with multiple ways of preparing coffee. But for this example let's just assume that the following two methods (METHOD 1 and METHOD 2) are the only two available methods for preparing coffee.

The answer is "yes", there is generally more than one algorithm for a particular problem. And that brings us to the topic of Algorithm Evaluation.

**Why do we need Algorithm Evaluation?**The answer is pretty simple, we need Algorithm Evaluation to find the best (or a reasonable and valid) algorithm by comparing the available algorithms for a particular problem.

**Real life example...**Consider a scenario where you are about to prepare some coffee. And as we know there is no one single specific way to prepare coffee so we can come up with multiple ways of preparing coffee. But for this example let's just assume that the following two methods (METHOD 1 and METHOD 2) are the only two available methods for preparing coffee.

( And yes I prefer coffee with sugar )

Now the big question is how to figure out which one is the better way to prepare coffee. In reality, none of the ways is perfect because it always comes down to the preference of the person who is going to have the coffee and the person who is going to prepare the coffee.

METHOD 1 (requirements): ground coffee, sugar, cup, hot water.

METHOD 2 (requirements): ground coffee, sugar, cup, water, coffee maker.

As we can see the requirements mentioned above are needed to prepare the coffee by the corresponding method. So, we can say that the right method to prepare coffee depends on the availability of those requirements too.

And before you guys end up thinking of this post to be some kinda cookery course I should come back to the main topic, i.e. Algorithm Evaluation.

So, why did I mention the coffee making example? It's because at the basic level it is really similar to any other algorithm that we might encounter in CS. The methods (METHOD 1 and METHOD 2 are the algorithms, the requirements being the resources). So, we can say that In similar terms the efficiency of a computer algorithm also depends on the resources and time required by the algorithm.

**Major factors for Algorithm Evaluation...**- The efficiency of the algorithm
- Readability of the algorithm

**How to compare efficiency?**

There are two methods to compare efficiency :

- Empirical Comparison (Comparison based on the real-time result and is Machine dependent.)
- Algorithm Analysis (Comparison based on estimation and is machine independent.)

*( If you like the content here, follow*

**TSP**on social media to get notified on future updates)
## Comments

## Post a Comment