15.2 Why learn Asymptotic Analysis?

Why learn Asymptotic Analysis?

By learning asymptotic analysis, we can compare different algorithms and see which algorithm has a slower growth rate, or put differently, which algorithm is more efficient.
Let’s say we have two algorithms. One of the algorithms is slower for smaller input sizes but faster for larger input sizes. The other algorithm is faster for smaller input sizes but slower for larger input sizes. In this case, we would choose the algorithm that does better for larger input sizes. Why? Because small input sizes take a small amount of time to run regardless of how slow the algorithm is. For bigger input sizes, the difference between the running times of different algorithms grows larger and larger. These algorithms can be the deciding factor of whether or not a process takes seconds, minutes, or even hours to run.
notion image
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.