1. Give the BigO notation for each of the following pseudocode fragments.
(A)
k = 0
loop( k < n )
s = s + ary[k]
k = k + 2
end loop
(B)
j = 1
k = 1
loop( k <= n )
s = s + j
j = j + 1
k = k * 2
end loop
(C) Show work!
k = 0
loop( k < n )
s = s + aryA[k]
k = k + 1
end loop
j = 0
loop( j < n )
s = s + aryB[j]
j = j + 1
end loop
(D) Show work!
k = 0
loop( k < n )
s = s + aryA[k]
k = k + 2
end loop
j = 1
loop( j < n )
s = s + aryB[j]
j = j * 2
end loop
(E) Show work!
k = 1
loop( k < n )
s = s + aryA[k]
k = k * 2
end loop
j = 1
loop( j < n )
s = s + aryB[j]
j = j * 2
end loop
Please, show how you get the results!
Get Answers For Free
Most questions answered within 1 hours.