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

What are keywords c?

592


What do you understand by friend-functions? How are they used?

633


Which built-in library function can be used to match a patter from the string?

731


What is void pointers in c?

576


Why we use stdio h in c?

568






Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

1645


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3237


Is multithreading possible in c?

557


Why c is called a middle level language?

627


What are the applications of c language?

613


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

627


How is = symbol different from == symbol in c programming?

602


Explain how do you use a pointer to a function?

628


What are pointers in C? Give an example where to illustrate their significance.

737


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1505