Comparing Algorithms
Explore the principles of comparing algorithms by focusing on their time and space efficiency. Learn how to perform analytical evaluation using worst-case analysis to fairly assess execution time and understand space requirements. This lesson also covers counting primitive operations in C++ programs to determine time complexity.
Note: If you have already covered our course Data Structures in C++: An Interview Refresher you may skip this chapter, since a chapter on Algorithmic Complexity Measures was a part of the said course, too.
Introduction
There are typically several different algorithms to solve a given computational problem. It is natural, then, to compare these alternatives. But how do we know if algorithm A is better than algorithm B?
Important Criteria: Time and Space
One important factor that determines the “goodness” of an algorithm is the amount of time it takes to ...