Question: Pseudocode Sample 1 and Questions // Description // number is a positive integer with n digits, where number i refers to the i th digit
Pseudocode Sample 1 and Questions
// 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 conversion(number,base,n) value = 0; unit = 1; for i = 0 to n value = value + numberi * unit; unit = unit * base; end return value;
Respond to the following:
What does the conversion function do? Please provide a detailed response.
In terms of n, how many computational steps are performed by the conversion function? Note: One computational step is considered one operation: one assignment, one comparison, et cetera. For example, the execution of a = c + d may be considered two computational steps: one addition and one assignment.
What is the Big-O time complexity of the conversion function in terms of n? Justify your response.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
