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
Answer Posted / 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 |
Post New Answer View All Answers
Is c language still used?
What is calloc in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What are the types of i/o functions?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
What are the disadvantages of external storage class?
Write a program to check whether a number is prime or not using c?
Explain how are portions of a program disabled in demo versions?
How do I swap bytes?
Can a pointer be null?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What is the difference between union and anonymous union?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is the difference between malloc() and calloc()?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?