From the course: Faster Python Code
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Big-O notation
- [Instructor] You'll often hear the term Big O in relation to performance. Big O Notation basically means in the worst-case, how long will our code run given a specific input? How long usually means the number of operation or, if you're looking at the memory, the size of memory. For example, let's say we'd like to know if a given number is inside a list. Ideally, it will be the first number on the list and we'll do one comparison. In the worst-case, the number won't be on the list and will iterate over the whole list to find out it's not there. Assuming the size of the list is N, we say the complexity is O of N. This is a very simple case and for more complex algorithms determining the complexity can be very difficult task. Lucky for us, someone else already figure out the complexity of most of the algorithms and data structures in use. For example, sorting is O of N times log N where log stands for logarithm. The nice folks at Python created a list on the complexity of various…
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.