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

Answers were Sorted based on User's Feedback



Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / k.kavitha

1) Quick sort

Is This Answer Correct ?    25 Yes 2 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / 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

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / rohith

quick sort is the best sorting algorithm because time
complexity is O(nlogn)

Is This Answer Correct ?    5 Yes 0 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / keerthana

Merge Sort.

Is This Answer Correct ?    6 Yes 5 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / 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

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / khushboo

BUbble sort

Quick Sort will take nlogn time and also merge sort

But bubble sort will take only O(n) as we can detect no
shift of position in first scan itself...

Is This Answer Correct ?    2 Yes 2 No

Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Qu..

Answer / mini

bubble sort

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More C Interview Questions

what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,tracker: for(tracker=0;tracker<=a;tracker++) sum+=tracker; printf(ā€œ %d\nā€,sum); } what is the difference between a=10 and a=010??

3 Answers   Oracle,


Which weighs more, a gram of feathers or a gram of gold?

2 Answers  


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

0 Answers  


What are pointers? What are stacks and queues?

0 Answers   Hexaware,


what is computer

4 Answers  






Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,


write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer

1 Answers  


SRUCTURE PROGRAMMING

3 Answers   CTS, Wipro,


main() { int a=4,b=2; a=b<<a + b>>2; printf("%d", a); }

4 Answers   CTS,


What is an identifier?

0 Answers  


what are the languages used in c#?

3 Answers   Infosys,


What is the output of following program ? int main() { int x = 5; printf("%d %d %d\n", x, x << 2, x >> 2); }

5 Answers   Amazon, Qualcomm,


Categories