Question: Consider the same operation - counting rules and Python program we saw in the last video's question: Each addition and subtraction costs 1 Each comparison
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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
