of 1.00
S:= 0
Flag question
for i:=1 to n do
if a mod 20 then S:= S + a
else S:S-a
return S
Choose all the right answers:
a. The output is<0 whenever all elements of the input e<0.
b.The output S is > 0 only if the input contains more even elements than odd elements.
✔c.The time complexity of this algorithm is O(n).
d. S=-1 is the output corresponding to the input (-3, 1, 4, -2, 5).
e. If (-2, 0, 2, 4, 5) is the input then the output is S=1
The correct answers are:
C=-1 is the output corresponding to the input (-3, 1, 4, -2, 5).,
The time complexity of this algorithm is O(n).
Question 5
Complete
Mark 1.00 out of 1,00
Flag question
b. (5, 13, 16)
c. (2, 3, 11)
Let A = {n∈ N❘n is a prime and n-2 is a square number} and B=\{n\in\mathbb{N}|n\le30\}, where N is the set of all natural number. Determine the set An B.
a. (3, 11, 17, 31}