What is the worst case running time of the algorithm below E
What is the worst case running time of the algorithm below? Express your answer in Big O notation. Show your work. int foo (int k, int n) {int result = 0 for (int i = 0; i
Solution
The function run in runs in linear time
First Loop having Time Complexity is considered as O(k)
First Loop having Time Complexity is considered as O(n)
Worst Case Time Complexity is considered as O(k + n)
Worst Case Time Complexity is considered as O(N) -- If k=n=N
