1

Which of these are correct? worst and best case run time for insertion and merge sort?

insertion sort (best case): big O(n) or theta (n) (worst case):big O(n^2) or theta (n^2)?

merge sort (best case) : big O(n log n) or theta (n log n) (worst case) : big O (n log n) or theta (nlog n)?

  • Welcome to StackOverflow. [On topic](https://stackoverflow.com/help/on-topic), [how to ask](https://stackoverflow.com/help/how-to-ask), and ... [the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) apply here. As these are well-known metrics, we expect that you can look them up on your own. Your question doesn't detail where you're stuck on answering these issues. – Prune Nov 14 '19 at 23:35
  • read the following: https://en.wikipedia.org/wiki/Insertion_sort https://en.wikipedia.org/wiki/Merge_sort – hazirovich Nov 15 '19 at 04:38
  • See also https://stackoverflow.com/a/471206/56778 – Jim Mischel Nov 15 '19 at 18:28

1 Answers1

1

Both of them are correct. Good luck

erfan30
  • 105
  • 7