GeekInterview.com
Series: Subject: Topic:
Question: 79 of 248

What are the various kinds of sorting techniques? Which is has least worst case?

These are some sorting techs,

bubble sort
quick sort
insertion sort
selection sort
merge sort
heap sort

tell me any more sorting is found..... ad which is best....
Asked by: mikerich135 | Member Since May-2007 | Asked on: Jun 23rd, 2007

View all questions by mikerich135   View all answers by mikerich135

Showing Answers 1 - 7 of 7 Answers
ratheeshnellikkal

Answered On : Nov 6th, 2007

Among the sorting algorithms quick sort is the best one

  
Login to rate this answer.
manishmodgil

Answered On : Dec 28th, 2007

View all answers by manishmodgil

Sorting techniquesBubble sortSelection sortInsertion sortQuick SortHeap SortBucket SortHashing technique.BST could be classified as a sorting technique.The best sorting technique for a particular problem largely depends upon the problem at hand ( domain and size of the problem ) and the resources available ( memory, CPU and time ). Heap sort has the least worst case complexity.

  
Login to rate this answer.
sunils34

Answered On : Jan 20th, 2008

View all answers by sunils34

There are a few other sorting algorithms which are distribution based algorithms. Examples of these are Bucket Sort, Counting Sort, and Radix sort which can operate O(n) depending on the the input.

Yes  1 User has rated as useful.
  
Login to rate this answer.
anjali9477

Answered On : Jan 21st, 2008

View all answers by anjali9477

There are various Sorting techniques They are Internal and External Sorting.Various Internal sorting tecniques are as follows: Bubble sortInsertion sortSelection sortQuick sortMerge sortHeap sortRadix sortbucket sortShell sortFor small input size shell sort  is  best choice

  
Login to rate this answer.
rohini.nitd

Answered On : Aug 16th, 2009

View all answers by rohini.nitd

Shell Sort, Radix Sort
The complexity is depend on the given data
If it is in sorted order insertion sort is best one and quick is worst
If not quick shows good results etc.
So it is just depend on the order of given data

  
Login to rate this answer.
vinod148

Answered On : Oct 23rd, 2009

View all answers by vinod148

HEAP sort is the best algorithmO(n log n) time for best, avg and worst caseO(1) spacelet me know if any other sorting algorithm present if that exceeds the limit i gave

  
Login to rate this answer.
akshay

Answered On : Aug 25th, 2011

BUBBLE SORT:

Code
  1. BUBBLE SORT:
  2. #include<iostream.h>
  3. #include<string.h>
  4. #include<math.h>
  5. #include<stdlib.h>
  6. void main()
  7. {
  8.         int a[10],n,temp;
  9.         cout<<"Enter number of elements:";
  10.         cin>>n;
  11.         cout<<"Enter no's: "<<endl;
  12.         for(int i=0;i<n;i++)
  13.         {
  14.             cin>>a[i];
  15.         }
  16.         cout<<"Sorted list is:";
  17.         for(int m=0;m<n-1;m++)
  18.         {
  19.                 for(int p=m+1;p<n;p++)
  20.                 {
  21.                         if(a[p]<a[m])
  22.                         {
  23.                           temp=a[p];
  24.                           a[p]=a[m];
  25.                           a[m]=temp;
  26.                         }
  27.  
  28.                 }
  29.  
  30.  
  31.         }
  32.         for(int x=0;x<n;x++)
  33.         {
  34.                 cout<<a[x]<<endl;
  35.         }
  36.  
  37. }
  38.  

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.