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
From the course: Get Ready for Your Coding Interview
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Why time complexity and big O notation?1m 52s
-
(Locked)
Overview of time complexity4m 9s
-
(Locked)
Overview of big O notation5m 53s
-
(Locked)
Evaluating time complexity using big O3m 16s
-
(Locked)
Practical example of time complexity and big O2m 39s
-
(Locked)
Sample interview question #4: Big O1m 17s
-
(Locked)
Visual solution to sample question #43m 5s
-
(Locked)
Code solution to sample question #43m 51s
-
(Locked)
-
-