Time complexity
Time complexity is not the time taken by a computer. It is a function that gives a relationship about time will (grows) increase as increase the input.
Notation:
- Big o notation : f(x) < = g(x)
- little big o nation : f(x) < g(x) [strictly]
- big omega notation : f(x) >= g(x)
- little big omega notation: f(x) > g(x) [strictly]
- big theta notation: g(x) < f(x) <g(x)
if f(x) = 3x+2, g(x) = n
Space complexity : actual space(input) + auxiliary space (extra space)
SC for recursive function= height of the tree (path)
because all the same level functions do not come in that stack at the same time.
Comments
Post a Comment