In the following code, what is the algorithm's complexity?
?
minIndex = 0currentIndex = 1
while currentIndex < len(lyst): if lyst[currentIndex] < lyst[minIndex]: minIndex = currentIndex currentIndex += 1return minIndex
?
A. O(n2)
B. O(n)
C. O(log2n)
D. O2
Answer: B
Computer Science & Information Technology