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


Please Help Members By Posting Answers For Below Questions

largest Of three Number using without if condition?

1009


What is the difference between the expression “++a” and “a++”?

652


What is queue in c?

582


What does & mean in scanf?

606


Can we add pointers together?

622






Explain what is wrong with this program statement?

624


Can a pointer be null?

567


c program to compute AREA under integral

1816


Why is c still so popular?

618


What is an lvalue?

638


Why c is called a middle level language?

635


What is the difference between near, far and huge pointers?

630


What is a good data structure to use for storing lines of text?

601


What is volatile, register definition in C

693


Array is an lvalue or not?

642