Question: // Description // number is a positive integer with n digits, where number i refers to the i th digit of number // n is

// Description

// number is a positive integer with n digits, where numberi refers to the ith digit of number

// n is the number of digits of c

// base is a positive integer

function printToScreen(n)

for i = 1 to n

for j = 1 to i

print("*");

end

print(" ");

end

  1. What does theprintToScreenfunction do? Please provide a detailed response. Specifically, describe the pattern formed by the *'s being printed. Note thatprint("*") will print one star andprint(" ") will print a carriage return, which effectively brings the cursor to a new line.
  2. In terms ofn, how many computational steps are performed by theprintToScreenfunction? Justify your response.Note:One computational step is considered one operation: one assignment, one comparison, et cetera. For example, the execution ofprint("Hello") may be considered one computational step: one print operation.
  3. What is the Big-O (worst-case) time complexity of theprintToScreenfunction in terms ofn? Justify your response.

please look in comments for question"?

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