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
From what I understand of big-O,
O(x+y) = O(max(x,y))
Therefore,
O(n + n log n) = O(n log n)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With