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.
Why time complexity and big O notation?
From the course: Get Ready for Your Coding Interview
Why time complexity and big O notation?
- [Instructor] In this chapter, we're going to talk about something called time complexity and big O notation, but why do we need them in the first place? Well, let's say in your coding interview, you're given a problem and you come up with two separate solutions or two separate functions. How do you know which one is a better solution? How do you know which function runs faster than the other one? You should be able to answer a question like this, because it's very common for the interviewer to ask something like, "How efficient is your solution?" And time complexity and big O notation are really good tools for answering these type of questions. Now, as an example, let's think about this question. How long does the following function take to complete? In the function, we first initialize X to zero, and for each item in the given list, we add that item to X. After that, we're going to return X. So this function simply finds a…
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)
-
-