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
How can you pass an array to a function by value?
why do some people write if(0 == x) instead of if(x == 0)?
Why we not create function inside function.
What is the use of a ‘ ’ character?
What is a keyword?
What is difference between && and & in c?
What is graph in c?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
How do you use a 'Local Block'?
Explain spaghetti programming?
What does d mean?
Explain what is meant by 'bit masking'?
Write a code on reverse string and its complexity.
write a program to display all prime numbers
Explain what does the function toupper() do?