Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

What is the relationship between diversity, inclusion, and equity?

Answered: 1 week ago