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
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 |
Answer / rohith
quick sort is the best sorting algorithm because time
complexity is O(nlogn)
| Is This Answer Correct ? | 5 Yes | 0 No |
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 |
Tell me is null always defined as 0(zero)?
What is #error and use of it?
In which header file is the null macro defined?
which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....
What is c preprocessor mean?
what is the code for getting the output as * ** ***
What is conio h in c?
What is the 'named constructor idiom'?
Do you know what are the properties of union in c?
write a code for large nos multilication (upto 200 digits)
What is the use of extern in c?
What is volatile keyword in c?