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 |
What is the use of the sizeof operator?
What is a 'null pointer assignment' error?
What is calloc() function?
Explain high-order and low-order bytes.
#‎include‬<stdio.h> void main() { int i; for(i=5;0;i++) { printf("%d",i); } }
How do we open a binary file in Read/Write mode in C?
What is the difference between a free-standing and a hosted environment?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));
What is the purpose of ftell?
What are the restrictions of a modulus operator?