Final answer:
The time complexity of Algorithm B is O(n).
Step-by-step explanation:
The time complexity of Algorithm B is O(n). This means that the time it takes for Algorithm B to solve a problem increases linearly with the size of the problem. For example, if an input of size 10 takes 1 second to solve, an input of size 100 would take approximately 10 seconds.
The options given in the question are:
A. O(log n), which represents logarithmic complexity and is not applicable in this case.
B. O(n), which represents linear complexity and is the correct answer.
C. O(n^2), which represents quadratic complexity and is not applicable in this case.
D. O(1), which represents constant complexity and is not applicable in this case.