Big O - O(log(n)) code example

后端 未结 7 1245
予麋鹿
予麋鹿 2020-12-23 12:37

Like the Big O notation \"O(1)\" can describe following code:

O(1):

    for (int i = 0; i < 10; i++) {
        // do stuff 
        a[i] = INT;
    }

O         


        
相关标签:
7条回答
  • 2020-12-23 13:00

    For O(logn), please have a look at any code that involves divide and conquer strategy Example: Merge sort & quick sort(expected running time is O(nlogn) in these cases)

    0 讨论(0)
提交回复
热议问题