Suppose your code contains a loop that runs once for each number
in a list. Assume there are 4 basic steps of work to do before the
loop and 2 after, and the loop does 3 meaningful steps of work for
each iteration of the loop. You may assume that a basic step of
work is represented as 1.
(a) Write an expression to describe the work of the program in
terms of the size of the list. Refer to the size of the list as
n
1
(b) Determine the algorithmic time complexity of the program, for
example logarithmic, linear, quadratic,cubic, exponential. Also
name its Big Oh complexity, for example O(1), O(logn), O(n),
O(n2),...
Please find the clear explanation below.
Get Answers For Free
Most questions answered within 1 hours.