In programming world, algorithms are important to solve complex problems. And to solve a problem, we have different algorithms available. Finding an efficient algorithm to solve a problem is important. But how to compare and find an efficient algorithm?
Let’s take a real life example of comparing performance of available bikes in market. When we compare bikes we generally take acceleration and top speed into consideration. And to do the same we need a scale.
When we talk about an algorithm efficiency, there are couple of aspects which we need to keep in mind -
- Time Complexity
- Space Complexity
Time complexity is calculated based on number of operations an algorithm needs to perform. Whereas, space complexity is calculated based on storage (primary or secondary) it needs.