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

#### ratheeshnellikkal

• Nov 6th, 2007

among the sorting algorithms quick sort is the best one

#### manishmodgil Profile Answers by manishmodgil

• Dec 28th, 2007

Sorting techniques

Bubble sort
Selection sort
Insertion sort
Quick Sort
Heap Sort
Bucket Sort
Hashing 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.

#### sunils34 Profile Answers by sunils34

• Jan 20th, 2008

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.

#### anjali9477 Profile Answers by anjali9477

• Jan 21st, 2008

There are various Sorting techniques
They are Internal and External Sorting.
Various Internal sorting tecniques are as follows:
Bubble sort
Insertion sort
Selection sort
Quick sort
Merge sort
Heap sort
bucket sort
Shell sort

For small input size shell sort  is  best choice

#### rohini.nitd Profile Answers by rohini.nitd

• Aug 16th, 2009

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

#### vinod148 Profile Answers by vinod148

• Oct 23rd, 2009

HEAP sort is the best algorithm

O(n log n) time for best, avg and worst case
O(1) space

let me know if any other sorting algorithm present if that exceeds the limit i gave

#### akshay

• Aug 25th, 2011

BUBBLE SORT:

```CodeBUBBLE SORT:
#include<iostream.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
void main()
{
int a[10],n,temp;
cout<<"Enter number of elements:";
cin>>n;
cout<<"Enter no's: "<<endl;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Sorted list is:";
for(int m=0;m<n-1;m++)
{
for(int p=m+1;p<n;p++)
{
if(a[p]<a[m])
{
temp=a[p];
a[p]=a[m];
a[m]=temp;
}

}

}
for(int x=0;x<n;x++)
{
cout<<a[x]<<endl;
}

}
```

Send   Reset