Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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..

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..

bubble sort

 Is This Answer Correct ? 4 Yes 5 No

More C Interview Questions

What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

What are the types of unary operators?

You have an int array with n elements and a structure with three int members. ie struct No { unsigned int no1; unsigned int no2; unsigned int no3; }; Point1.Lets say 1 byte in the array element is represented like this - 1st 3 bits from LSB is one number, next 2 bits are 2nd no and last 3 bits are 3rd no. Now write a function, struct No* ExtractNos(unsigned int *, int count) which extracts each byte from array and converts LSByte in the order mentioned in point1.and save it the structure no1, no2, no3. in the function struct No* ExtractNos(unsigned int *, int count), first parameter points to the base address of array and second parameter says the no of elements in the array. For example: if your array LSB is Hex F7 then result no1 = 7, no2 = 2, no3 = 7. In the same way convert all the elements from the array and save the result in array of structure.

Write a C program where input is: "My name is xyz". output is: "xyz is name My".

To find whether a number is even or odd without using any conditional operator??

What are the keywords in c?

What is difference between function overloading and operator overloading?

How can we open a file in Binary mode and Text mode?what is the difference?

write a program to find the number of even integers and odd integers in a given array in c language

Given an array A[n+m] of n+m numbers, where A ... A[n] is sorted and A[n+1] ... A[n+m] is sorted. Design a linear time algorithm to obtain A[1...n+m] sorted using only O(1) extra space. Time Complexity of your algorithm should be O(n) and Space Complexity O(1).

increment operateor (++)and decrament(--) #include<stdio.h> #inclide<conio.h> main() { int x=15; while(x!=0) scanf("%d",&x); {

how to find the given number is prime or not?

Categories
• C (4646)
• C++ (3460)
• VC++ (653)
• Delphi (566)
• Python Related (3238)
• PHP Related (7341)
• Scala (340)
• R Programming (396)
• Kotlin (184)
• Apache Groovy (39)
• Ruby (245)
• Go Programming Language (139)
• Objective-C (429)
• Programming Languages AllOther (736)