Predict Complexity:
for(i=0,j=0;i<n;i++)
{
while(a[i]>a[j])
{
j++;
}
}
Predict Complexity:
for(i=0,j=0;i<n;i++)
{
while(a[i]>a[j])
{
j++;
}
}
hello @shresthdewan
j is initilaised only once , so inner loop will start from where it stopped in last iteration.
this way it will not run more than o(n)