I have created a name for all followers of my slog. From here on out you wonderful readers shall be called Johnny's. So thank you Johnny, for reading my slog, you are a beautiful soul. Today we learned about runtimes of functions. Some functions have a logarithmic or linear running time, others have quadratic runtimes, or exponential or even worse factorial running times.
This is similar to math where we learn about which functions increase faster as you take the limit to infinity in order to find limits of combinations of functions. In the applied case of computer science, there are times when functions handle very large lists of values, some millions of values in length, this is where run time comes in to play. A linear function and quadratic function may have very similar running times (A quadratic function might even start off faster then a linear function) and the extra time may be inconsequential when the size of the parameters passed is small, but as the size of the parameters increases, the discrepancy between a linear and quadratic function gets larger and larger, and for very large values, this time difference is very big. Thus if two functions perform a similar task that requires handling very large values or lists, then it is important to use the function that has the smallest running time. A classic case of this are sorting algorithms.
Here's a picture of the run time of different functions mapped as the input size increases
Thanks for reading Johnny, you da best.
No comments:
Post a Comment