n log n is O(n)?

前端 未结 3 1622
慢半拍i
慢半拍i 2020-12-04 11:33

I am trying to solve this recurrence

T(n) = 3 T(n/2) + n lg n ..

I have come to the solution that it belongs to masters theorem case 2 since n lg n is O(n^2

3条回答
  •  一生所求
    2020-12-04 12:14

    nlg3 is not O(n). It outgrows O(n)... In fact, any exponent on n that is larger than 1 results in an asymptotically longer time than O(n). Since lg(3) is about 1.58, as long as you subtract less than .58 from the exponent it is asymptotically greater than O(n).

提交回复
热议问题