Mergesort BigO Runtime

The "Unfriendly Algorithms for Masters" bindings in the tutorial say that the merge time sort is O (n ^ 4). Is this statement correct?

Solution: Yes. This statement is technically correct, since O (n ^ 4) gives only the upper one for how long the algorithm has been running. However, his unpleasant useless answer, as a tight borderΘ(n log n).

I do not quite understand what is said in this decision. How can O (n ^ 4) be right?

+3
source share
2 answers

The Big O designation is the worst-case upper case for algorithm execution time.

O (n ^ 4) , , , .. Mergesort , O (n ^ 4).

, O (n log n), " "

+5

Big-O - , , , (foo) . Little-O - , , (foo). , mergesort O (n ^ 4), , Theta (n log n). , mergesort o (n ^ 4), , , .

, -O , big-theta , , .

+1

Source: https://habr.com/ru/post/1772309/


All Articles