Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 ?
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started