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 / 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 |
Post New Answer View All Answers
What’s the special use of UNIONS?
What is the maximum no. of arguments that can be given in a command line in C.?
What are the types of pointers?
How many types of operators are there in c?
What are the types of bitwise operator?
What is the explanation for cyclic nature of data types in c?
Explain what is meant by 'bit masking'?
How can a string be converted to a number?
Why cant I open a file by its explicit path?
why do some people write if(0 == x) instead of if(x == 0)?
Why do we use c for the speed of light?
Why use int main instead of void main?
For what purpose null pointer used?
What are identifiers c?
How do you determine a file’s attributes?