MaheshT.com

June 1, 2011

Sorting : Merge sort

Filed under: Java,Programming — MaheshT @ 8:47 pm

Performance

  • Best: O(n log n)
  • Average: O(n log n)
  • Worst:O(n Log n)

Steps in mergesort

  • Recursively Keep on splitting the list until each list has 1 or 2 elements.
  • If the list has one element it is already sorted.
  • If the list has two elements then sort it.
  • Combine lists in sorted order in an upward direction.

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress