I have a quiz tomorrow and cannot figure out a few of the examples he wishes us to complete. They seem pretty basic.
Add (Input a list of numbers A1,A2.....An)
Step 1: Let i =1 and S = 0
Step 2: Replace S by S+Ai and replace i by i + 1
Step 3: If i<= N go to step 2
Step 4: Output S
A: Walk through this algorithm for the input list: 3,5,2,8,12,10
B: Find function of which gives the total number of elementary operations required as a function of the number of items on the list A1,A2....An that is input
C: To which common complexity lass does the function in part B belong?
If I could get help with this example I could use it to reference the others that are similar and most likely figure them out. Thank you so much in advance to anyone that has the time to help me out! PS Sorry for the bad text formatting :/