Consider the same operation - counting rules and Python program we saw in the last video's question:
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider the same operationcounting rules and Python program we saw in the last video's question:
Each addition and subtraction costs
Each comparison a b costs
Everything else is free
def funnx:
counter n
amount
while counter :
amount amount x
counter counter
return amount
As we saw before, the cost of calling this function, by the above rules, is n
What is the smallest expression g such that the cost of calling the function is Og
Related Book For
Posted Date: