0

I want to know the procedure by which we can calculate time complexity of a C program.

and how would we compare two algorithms.

here are two sorting programs. how to compare both.

```
for(i = 0; i < n - 1; i++)
for(j = i + 1; j < n; j++)
if(num[i] > num[j])
{
temp = num[i];
num[i] = num[j];
num[j] = temp;
}
```

```
for(i = n - 1; i >= 0; i--)
for( j = 0; j < i; j++)
if(num[j] > num[j+1])
{
temp = num[j];
num[j] = num[j+1];
num[j+1] = temp;
}
```

Thanks