Friday, 13 September 2013

Is O(n) + O(n log n) equals to O(n log n)?

Is O(n) + O(n log n) equals to O(n log n)?

One code I've done follows this schema:
for (i = 0; i < N; i++){ // O(N)
//do some processing...
}
sort(array, array + N); // O(N log N)
Whats the complexity in Big-O notation?
Thanks in advance

No comments:

Post a Comment