Algorithm Practice Question for Beginners | Set 1 - GeeksforGeeks
Consider the following questions for above code ignoring compiler optimization.
a) What does the above code do?
b) What is the time complexity of above code?
c) Can the time complexity of above function be reduced?
What does fun(n) do?
In the above code, fun(n) is equal to 2*fun(n-1). So the above function returns 2n. For example, for n = 3, it returns 8, for n = 4, it returns 16.
Read full article from Algorithm Practice Question for Beginners | Set 1 - GeeksforGeeks
Consider the following questions for above code ignoring compiler optimization.
a) What does the above code do?
b) What is the time complexity of above code?
c) Can the time complexity of above function be reduced?
What does fun(n) do?
In the above code, fun(n) is equal to 2*fun(n-1). So the above function returns 2n. For example, for n = 3, it returns 8, for n = 4, it returns 16.
Read full article from Algorithm Practice Question for Beginners | Set 1 - GeeksforGeeks