i): The outer loop is running n
times so you touch every element n
times in the outer loop.
The inner loop is also running n
times, so you touch every element n*n
times so its
O(n^2)
ii) The loop is running n*n
times so it simply is O(n^2)
solved time complexity for given scenario of code [closed]