For (I=1 through N)
2 For (j=1 through I)
3 For (k= 1 through 5)
Task T
Task T requires t time units
The third For (inner loop) requires 5 * t
The second For requires 5 * t * I
The first For requires (as function of I):
5*t*1 + 5*t*2+…+5*t*N= 5*t(1 +2 +…+N)
= 5*t(N+1)*N/2 time units
1 For (I=1 through N/2)
2 For (j=1 through 2I)
3 For (k= 1 through 5)
Task T
The third For (inner loop) requires 5 * t,
The second For requires 5 * t * 2i,
The first For requires (as function of I):
5*t*20 + 5*t*21 + 5*t*22+…+5*t*2N/2
5*t(1+2+4 +…+2N/2)
= 5*t(2N/2+1 -1) time units, N is even
= 5*t(2(N+1)/2 -1 + 2N/2) time units, N is odd
ارجو شرح مفصل للامثلة و ايضا المثالين الموجود فى المرفقات صفحة 2و3
و لكم جزيل الشكر