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
- 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.
- 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.
- 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
Get step-by-step solutions from verified subject matter experts
