Multiple choices 30/50
(Choose 1 answer)
A. None of the other choices is correct
(See picture)
B. (i)
C. (iii)
D. (ii)
Next
Determine the complexity of this algorithm in terms of the number of comparisons.
procedure thuattoan(a1, a2..., an: integers)k: 0 for i:=1 to n do if a < 0 then k := k+1 print(k)
(i) O(n)
(ii) O(logn)
(iii) O(1)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 41 47
43
44
45 46 47 48
49 50