Python Language Notation


Basic Idea

The notation used when describing the speed of your Python program is called Big-O notation. Let's say you have a function:

def list_check(to_check, the_list):
    for item in the_list:
        if to_check == item:
          return True
    return False

This is a simple function to check if an item is in a list. To describe the complexity of this function, you will say O(n). This means "Order of n" as the O function is known as the Order function.

O(n) - generally n is the number of items in container

O(k) - generally k is the value of the parameter or the number of elements in the parameter