Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show that the summation ∑ i to n (logi) is O(nlogn) [closed]

Tags:

big-o

math

One way I thought it works is that we can say that ∑_i^{n (log i)} < ∑_i^{n (log n)} and then try to argue that it's O(n log n), but where to go from here? Any suggestions?

like image 344
user3196567 Avatar asked Jan 16 '14 03:01

user3196567


People also ask

Is summation a closed form?

This is known as a closed-form solution, and the process of replacing the summation with its closed-form solution is known as solving the summation. For example, the summation ∑ni=11 is simply the expression “1” summed n times (remember that i ranges from 1 to n).

Is Nlogn closer to N or N 2?

Save this answer. Show activity on this post. So, O(N*log(N)) is far better than O(N^2) . It is much closer to O(N) than to O(N^2) .

How can I find the time complexity of a series summation?

The time complexity for inserting the elements in the array is O ( N ) O(N) O(N) and for traversing the array to calculate the sum is O ( N ) O(N) O(N). Thus overall time complexity is O ( N ) O(N) O(N).

Is O N in O Nlogn?

So for higher values n, n*log(n) becomes greater than n. And that is why O(nlogn) > O(n). "Usually the base is always less than 4." The base is neither usually nor always less than 4.


1 Answers

If you just need to show that the sum is O(n log n), you can show that

Σ log i ≤ Σ log n = n log n

Therefore, your function is O(n log n). If you want to be even more formal, you can use the constants c = 1 and n0 = 1.

The more interesting question is to show that the sum is Θ(n log n) by proving an Ω(n log n) lower bound. To do this, note that the sum is greater than or equal to the sum of the last n / 2 terms in the summation. Each of those terms in the summation is at least log (n / 2). This gives a lower bound of (n / 2) log(n / 2) = (n / 2) (log n - log 2), which is Ω(n log n). Therefore, your summation is O(n log n) and Ω(n log n), so it's Θ(n log n).

Hope this helps!

like image 127
templatetypedef Avatar answered Sep 19 '22 11:09

templatetypedef