Question: 4. (10 points) Fill in the blanks below with complexity results stated in terms of n Assume print produces one line of output (a) Fragmernt

 4. (10 points) Fill in the blanks below with complexity results

4. (10 points) Fill in the blanks below with complexity results stated in terms of n Assume print produces one line of output (a) Fragmernt for i-n downto 1 print(n + " bottles of beer on the wall, "+ n + " bottles of beer") print("you take one down, pass it around, ") print((n-1) + " bottles of beer on the wall") end The above fragment prints (b) Fragment for i-1 to n print("On the + i + "th day of Festivus my true love gave to me") for j-i downto 1 print(i + " nifty "+i+ "-things") end end The above fragment prints e lines (c) Fragment for i-1 to n int[] array = new int [5]; end Worst-case, the above fragment takes e time (d) Fragment for i-1 to n int[] array = new int [i]; end Worst-case, the above fragment takes e time. (e) Fragment while (i > 0) print("Zeno is almost there") i-i/2 // integer division and result end Worst-case, the above fragment prints (--) lines

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!