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


Please Help Members By Posting Answers For Below Questions

What is the benefit of using const for declaring constants?

557


What is the use of getch ()?

590


What is the difference between c and python?

559


Can you return null in c?

574


What is property type c?

584






What are bitwise shift operators in c programming?

616


Is main a keyword in c?

605


Explain pointers in c programming?

604


What is a constant and types of constants in c?

583


What are the modifiers available in c programming language?

698


Why n++ execute faster than n+1 ?

1787


what are # pragma staments?

1601


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

722


Why c is called procedure oriented language?

547


What is the use of gets and puts?

572