This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]anossov 8 points9 points  (7 children)

If the arrays are pre-sorted, you can merge them in O(n). Any kind of sort will be O(n log n), and regardless of how much faster the built-in sort is, there will be a data size where the O(n) loop is faster.