Question: elow is a pseudocode algorithm that prints a set of output values: Get value for n from the user k = 1 while k <

elow is a pseudocode algorithm that prints a set of output values:
Get value for n from the user
k =1
while k<=n do steps 4 through 8
j = n/2
while j>=1 do steps 6 and 7
print j
j = j/2
k = k +1
stop
a. Let n have the value 4. Write the values printed by this algorithm
b. Let n have the value 8. Write the values printed by this algorithm
c. Which big-O describes the efficiency of this algorithm (for this let's assume that the unit of work being counted is printing a value):
O(n^2) O(nlog(n)) O(n). O(log(n))

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 Programming Questions!