Question: How did they get the equation (t+3c)m + 2c ? while i s m do In most situations, it is reasonable to count at unit

How did they get the equation (t+3c)m + 2c ?

How did they get the equation (t+3c)m + 2c ? while i

while i s m do In most situations, it is reasonable to count at unit cost the test i s m, the in- structions i -1 and i -i +1, and the sequencing operations (go to) implicit in the while loop. Let c be an upper bound on the time required by each of these operations. The time l taken by the loop is thus bounded above by for i -1 + (m+1)c for the tests i s m + mt + m +mc s (t +3c)m 2c. for the executions of P(i) for the executions ofi -i+1 for the sequencing operations Moreover this time is clearly bounded below by mt. If c is negligible compared to t, our previous estimate that l is roughly equal to mt was therefore justified, except for one crucial case: V a mt is completely wrong when m 0 (it is even worse if m is negative!). We shall see in Section 4.3 that neglecting the time required for loop control can lead to serious errors in such circumstances

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!