Question: Find () for code fragment 5 given in Figure 1. Your analysis should be patterned after the analysis in Figure 6 that used the example

Find () for code fragment 5 given in Figure 1. Your analysis should be patterned after the analysis in Figure 6 that used the example code fragment 0. Transform the code fragment into while-loops. Account for the cost of each line. Sum the total and express it in closed form.

A formal computation and verification demonstrating that () is (()).

Find () for code fragment 5 given in Figure 1. Your analysis

should be patterned after the analysis in Figure 6 that used the

example that proves t(n)=o(f(n))

example code fragment 0. Transform the code fragment into while-loops. Account for

int i 0 while(i1) Line Code Cost n-1o1-in n-1o1-in n-1o1-in 2 while(i1) 1-0 7 n-1o1-in 1 Total 2+4n+2n.log2m So, T(n) 24n2n.logm Find f(n). Let f(n) be the fastest growing term in T(n) with its coefficient removed. f(n) n 1. 2. Find C. 2.1. CCmin A, where A-1 (in many cases) Discrete Structures CMSC 2123 Code Fragment 5 Time Complexity Project po5 3n+3 2.3. In practice, Cmin is the coefficient of the fastest growing term in T( 4. Find no 4.1. Solve IT(no)l s CIf(no)l no 23 4.2. Choose an integer value for no. Let no3 We have shown that T(n) -3n+3 is O(n) because we have found witnesses C4 and no- 3

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!