Python
Big-O Coding
will give high rating if answers are correct ty!
Extracted text: Big-O Coding Exercise: Given: Consider the function below written in Python3: def bar(x, y): if y > 0: if (y % 2): return bar(x, y >» 1) + bar(x, y >> 1) + x return bar(x, y >» 1) + bar(x, y >> 1) else: return 0 Question: What is the worst-case auxiliary space complexity of bar(x, y)? (Follow/use the same notes above) Answer: What is the worst-case auxiliary space complexity of bar(x, y)? (Follow/use the same notes above) Answer: Notes when answering: Note that when complexities or expressions are asked: • Answer without the big-O. • Assume a, x, and y are very large. • Use 'log()' to add the logarithmic function (e.g. n log(n) is written as n* log(n )). • Use "(e)' to create exponents (e.g. 2" is written as 2^(n )). • Use 'sqrt()' to create square roots (e.g. Vn is written as sqrt(n )). • Remember that log, a = log a/log b.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here