Question: Line 1: def average (inputList): Line 2: n = len (inputList) Line 3: total = 0 Line 4: for i in range(n): Line 5: total

 Line 1: def average (inputList): Line 2: n = len (inputList)

Line 1: def average (inputList): Line 2: n = len (inputList) Line 3: total = 0 Line 4: for i in range(n): Line 5: total += inputList[i] Line 6: return total Analyze the time complexity of the above program. Your analysis should contain 1) a discussion on how many operations used per line, line 1 excluded. 2) what is the final representation of the complexity of this program, 3) what is the Big-o of the program, and 4) prove it following the formal definition of Big-0,5) is your provided Big-O in answer to 3) the tighest upper bound? Why? provide a short discussion

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