Appropriate sorting algorithm

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Can somebody guide me with the following question?
Let's suppose a user wants to check whether a given set of items is sorted or not. Which sorting method will be the most well organized if the list is already sorted?
Kindly guide me.

Zulfi.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your attention. They have provided following list:t
1. Bubble sort
2. Selection sort
3. Quick sort
4. Insertion sort


Kindly guide me.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,045
Hi,
Can somebody guide me with the following question?


Kindly guide me.

Zulfi.
Well, what is the order of complexity of various sorting algorithms under the case that the items are already sorted?

At least describe what you think would be the most efficient way to answer the question of whether a list of items is or is not already sorted.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
I found that the best case of insertion sort (i.e when the list is sorted ) is linear. This is the best algorithm.

Thanks for your guidance.

Zulfi.
 
Top