Issue
for(int i = 1;i<=n;i++)
{
for(int j = i;j<=n;j++)
{
//statement -> O(1)
}
}
The time complexity of the first loop (i) is O(n). I mainly have a problem with the second loop.
Thanks!
Solution
The overall time (asymptotic analysis) TC would be O(n^2), there will not be exactly n^2 operations!!
Answered By - Bharath Kalyan S
Answer Checked By - David Goodson (JavaFixing Volunteer)