RandomGuy
RandomGuy

Reputation: 667

Does O(N/2) simplifies to O(log n)?

I have one algorithm that only needs to run in O(N/2) time (basically it is a for loop that only runs over half of the elements).

How does this simplifies in the big O notation? O(log n)?

Upvotes: 1

Views: 986

Answers (1)

dee-see
dee-see

Reputation: 24088

Big O notation drops the factors. O(N/2) = O(1/2 * N) and simplifies to O(N).

If you want to know why the factor is dropped I would refer you to this other SO question.

Upvotes: 4

Related Questions