sort array efficiently

I have an array of values which is almost, but not quite sorted, with a few values displaced (say, 50 in 100000). How to sort it most efficiently?

Comments

  1. use smoothsort or timsort which performs nearly o(n) when array is partially sorted.

    ReplyDelete

Post a Comment

Popular posts from this blog