Running Time as a Function of Input Size
Learn how the running time of an algorithm is a function of the size of its input.
We'll cover the following...
A toy example
Let’s look at a toy example to help distill our notion of running time. We define a function GetSum
that takes an array and its length as inputs, and returns the sum of all the elements in the array.
Press + to interact
Viewing the running time as a function
Let’s look at the running time of each instruction in the above algorithm.
Note that each in the table below (where ...