70.9k views
1 vote
Algorithm B solves problems of size n. What is the time complexity of Algorithm B?

A. O(log n)
B. O(n)
C. O(n^2)
D. O(1)

User TERMINATOR
by
8.4k points

1 Answer

2 votes

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.

User Tim Scott
by
8.0k points

Related questions