Time and Space Complexity
Time Complexity
def get_sum(a,b):
return a+b
# The function has time complexity of two units, since two instructions
# 1. addition 2. return statement
# Hence time complexity of function get_sum is 2 units that is O(2)
# O(2) is read as order of 2 (which is constant time complexity)Time Complexity Notations
Time complexity Rules
Common asymptotic notations
Speeding-up API
Space Complexity
Optimising RAM Space
Recursive Function: Time and Space Complexity
Reference for Further Reading
Last updated