





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Statement Analysis โ Critical Section
Statement Analysis - Sequence Consecutive statements
Block #
Block #
t 1
t 2
t 1 +t 2 = max(t 1 ,t 2 )
Statement Analysis - If
If/Else:
if cond then
S
else
S2; Block #1 t 1 Block #2 t 2 Max(t 1 ,t2)
Statement Analysis โ Nested For
Nested For-Loops
running time of the statement multiplied by product of the sizes of all the for-loops
e.g. for (i =0; i < n; i++)
for (j = 0, sum = a[0]; j <= i ; j++)
sum += a[j]; printf("sum for subarray - through %d is %d\n", i, sum);
2
1
1 1 1
n
i
n
i
i
j
n
i
=
= = =