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.
Evaluating time complexity using big O
From the course: Get Ready for Your Coding Interview
Evaluating time complexity using big O
- Let's see how we can use what we've learned so far to evaluate the time complexity of a function using big O. To do this. We first need to go back to the concept that we covered at the end of the last video. We saw that two times big O of n is still O of n. Now what if we multiplied O of n by n. One way to think about it, is this. Big O of n might represent an expression like an plus b. If we multiply by n we would have half an squared plus bn. Taking the fastest growing term here an squared and ignoring the coefficient we get n squared. So n times big O of n is big O of n squared. In general, if you multiply a big O expressional with n you just need to put it inside the big O expression. For example, n times big O of x is equal to big O and nx, whatever x might be, whether it's one n or n squared. Or if you multiply a big O expression with anything, say y, you can just put it inside the big O expression as…
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)
-
-