1,031 views
2 votes
2 votes

Meena is working in an IT company as HR manager. She has a large list of potential candidates to be recruited which are all sorted by their names. But she found that due to a bug in software 'O' was treated as '0' by the input reader and hence the sorted list is not correct. What would be the appropriate algorithm to correct the list of candidate profiles?

  1. Quick Sort
  2. Heap Sort
  3. Insertion Sort
  4. Merge Sort

2 Answers

Best answer
1 votes
1 votes

Since among the option only Merge sort and Insertion sort are Stable Sort algorithm and it is been said that the list is already sorted by name, so in best case Merge sort takes O(nlogn) time and Insertion sort takes O(n) times.

So that's why it is Insertion Sort.

*NOTE- Stable Sort Algorithm are- Insertion sort, Merge sort, Bubble sort, Selection sort.

selected by
0 votes
0 votes
in best case merge sort and quick sort are same. but in worst case, merege sort is better. than how insertion sort?
Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked Nov 26, 2016
1,637 views
Three algorithms do the same task. Algorithm One is $O(N)$ and Algorithm Two is $O(\log N)$ and Algorithm Three is $O(N1/2)$. Which algorithm should execute the fastest f...
1 votes
1 votes
3 answers
2
0 votes
0 votes
0 answers
3
1 votes
1 votes
1 answer
4
Bikram asked Nov 26, 2016
842 views
Consider an array of elements $6 \ 4 \ 5 \ 3 \ 7 \ 1$. The contents of the array after three passes when we apply Bubble Sort on it is$3 \ 4 \ 1 \ 5 \ 6 \ 7$$3 \ 4 \ 5 \ ...