Site icon Study Algorithms

Analysis of Algorithms

There can be several aspects when you think about analysis of algorithms. You may be writing a large scale application where you have to decide between two choices. You may be trying to submit a solution to some online competition and you want a higher score, or probably you may just want to write fewer lines of code.

Fig: Analysis of Algorithms

Analysis during an Interview

Let’s say you are appearing for an interview. The person who is interviewing you gives you a problem to solve. He or she is not just interested in the solution but rather, they want to see how you approach the problem and what solution do you eventually come up with. Even after you have come up with a solution, there is a very good chance that your interviewer would ask you to think other solutions to the problem. That is probably because a better solution to the problem exists, and he/she wants you to figure it out.

You start to think again and this is where analysis of algorithms comes in handy. You could start to think of multiple solutions, but you need to first figure out for yourself, if they are better than the ones you have already told.

Analysis based on performance

An algorithm is basically just a series of steps to solve a problem. But it is not necessary that it will perform the same under all kinds of test cases.
Think about it like a car. If you get a car, it is not necessary that it will perform the same in a city, as on a highway. What about off road? It will have different kinds of performance.

Similar is the case with algorithms as well. An algorithm can behave differently based on the type of input data you have. This is known as the time complexity of an algorithm.

Topics covered in the playlist:

Watch these videos to do a deep dive into each of the topics.

Check out the complete playlist:

Exit mobile version