retagged by
580 views

1 Answer

2 votes
2 votes
The inner most loop will run for O(log(m)) as m is getting halved in every iteration of the while loop. Now, the loop with iterator j runs for n/1000 which is independent of the value of i. So, j runs for O(n) every time and then the outermost loop with iterator as i runs for O(n) time.

Therefore, total complexity = $O(n^{2}log(m))$ . So, (a) should be the correct answer.
Answer:

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
1 answer
2
2 votes
2 votes
1 answer
3
gauravkc asked Apr 5, 2018
906 views
What is the time complexity of this code?
3 votes
3 votes
1 answer
4