914 views
3 votes
3 votes
Consider the following statements

 The best case complexity of insertion sort is $\Omega \left ( n^{2} \right )$

The best case complexity of insertion sort is $O\left ( n \right )$

Which one true?

2 Answers

Best answer
3 votes
3 votes

2nd option is true!

Explanation :-

Best Case O(n) - If the input is in ascending order then we need only n comparisons for n elements and no movements

Worst case O(n2) - if input is in descending or other than ascending order. Because if input is in Desc order we need to do n comparisons and at max (n-1) movements.

selected by
0 votes
0 votes
Insertion sort Best case is O(n).

which can be written as

Ω(n^2) because bound will be >=c, here c is 'n'.

As far as I know this is correct. If its wrong then correct me.

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3
NeelParekh asked Jul 27, 2023
276 views
If an array is split in the form of increasing and decreasing order then what is TC to find minimum element in the array?
2 votes
2 votes
1 answer
4
h4kr asked Dec 30, 2022
465 views
What is the correct time complexity in $\theta()$ ?