Professional Documents
Culture Documents
776 PDFsam PythonNotesForProfessionals
776 PDFsam PythonNotesForProfessionals
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(k) - generally k is the value of the parameter or the number of elements in the parameter
Append : O(1)
Copy : O(n)
Insert : O(n)
Iteration : O(n)
Extend : O(k)
Multiply : O(nk)
x in s : O(n)
x in s : O(1)
Difference s - t : O(len(s))