Comparing Algorithms
Explore how to compare different algorithms by assessing their execution time and resource usage. Understand experimental versus analytical evaluation methods, learn to analyze worst-case, best-case, and average-case complexities, and grasp how primitive operations contribute to time complexity in C# programs.
Introduction
There are 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 solve a given problem. If algorithm A takes less time to solve the same problem than does algorithm B, then ...