Sorting an ArrayList whose first half is already relatively ordered -
i trying optimize sorting algorithm arraylist of 100 items. thing list has invariant first half of items in relative order themselves...
(i.e. {1,1,4,5,6,2,1,11,4,3}, because first 5 items relatively ordered).
in order take advantage of feature i'm considering sorting right half of list , merging 2 halves in order. reasoning sorting half list merging, can achieve time complexity of (m lg(m) + n) m = n / 2. make big-oh complexity better o(nlg(n)) or (m lg(m) + n) end reducing o(nlg(n)) anyways?
any insight regarding big-oh of problem or efficient approach problem appreciated.
Comments
Post a Comment