Can you do addition/multiplication with Big O notations?

前端 未结 4 736
执念已碎
执念已碎 2021-01-03 04:10

I\'m currently taking an algorithm class, and we\'re covering Big O notations and such. Last time, we talked about how

O (n^2 + 3n + 5) = O(n^2)
4条回答
  •  死守一世寂寞
    2021-01-03 05:00

    Also the following notations hold

    O(n^2) + n = O(n^2)
    

    and

    O(n^2) + Θ(3n+5) = O(n^2), Θ(n)
    

    Hope it makes sense...

提交回复
热议问题