From the course: Get Ready for Your Coding Interview

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Overview of time complexity

Overview of time complexity

- [Instructor] Time complexity and Big O Notation are a pair of powerful tools for understanding the efficiency of your function without actually running it on a computer. Let's first take a look at how time complexity works. To understand what time complexity is, let's take a look at the function we introduced in the last video, which finds the sum of all items in the given_list. And we're going to plot the time it takes to run this function against N, or the number of items in the given_list. So N represents the size of the input. Suppose that after running some experiments, it turns out when N is zero, or when the list is empty, this function takes 20 milliseconds to run in your particular environment. Now let's say every additional for-loop turns out to take one millisecond. So when N is equal to one, or when there is one single item in the list, this function takes 21 milliseconds. When N is two, T becomes 22…

Contents