Which of the following sorts is quickest when sorting the
following set: 1 2 3 5 4




1) Quick Sort


2) Bubble Sort


3) Merge Sort

Answers were Sorted based on User's Feedback



Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / k.kavitha

1) Quick sort

Is This Answer Correct ?    25 Yes 2 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / prof.gagandeep jagdev

Quick Sort, Since the array is already sorted, so this can
be considered as Best case example. The complexity of quick
sort in best case is O(n log n). No doubt , same is the
complexity of Merge sort in best case, but Quick sort
enjoys priority over Merge Sort because Merge sort requires
extra memory( an array) to store the sorted result whereas
quick sort do not specify any such need.

Is This Answer Correct ?    10 Yes 1 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / rohith

quick sort is the best sorting algorithm because time
complexity is O(nlogn)

Is This Answer Correct ?    5 Yes 0 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / keerthana

Merge Sort.

Is This Answer Correct ?    6 Yes 5 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / sreejesh1987

*I think answer is Bubble sort,because some comparisons are there,but only one swap(4 and 5).

*Best case for for quick sort for this problem applicable to
54321 element set. Here many swaps and comparison will occur.

*Merge sort also does actions of swaps and comparisons.

For most arrays, quick sort and merge sort are better.
But for a simple problem like this, bubble sort consume less operations.

Is This Answer Correct ?    1 Yes 0 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / khushboo

BUbble sort

Quick Sort will take nlogn time and also merge sort

But bubble sort will take only O(n) as we can detect no
shift of position in first scan itself...

Is This Answer Correct ?    2 Yes 2 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / mini

bubble sort

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More C Interview Questions

f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed

5 Answers  


Explain how are portions of a program disabled in demo versions?

0 Answers  


Is stack a keyword in c?

0 Answers  


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

0 Answers  


Explain how do you determine whether to use a stream function or a low-level function?

0 Answers  






Is it better to bitshift a value than to multiply by 2?

0 Answers  


What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

4 Answers   ADITI,


array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1}

12 Answers   Google, Motorola,


Explain what does the function toupper() do?

0 Answers  


how to sort two array of characters and make a new array of characters.

1 Answers   Accenture,


When is a void pointer used?

0 Answers  


How to write in a function declaration and in function call in which the function has 'n' number of varible or arguments?

2 Answers  


Categories