If you code in C you use the qsort() function. This type of sort has been around since the mid- 1960's, so people have gotten the function to work pretty well by swapping pointers rather than actual data.
Sample
Code:
#include <stdio.h>
#include <stdlib.h>
in num[10] = {1,3,5,2,4,6,7,9,8,0};
int compare(const *void, const *void);
int main(in argc,char *argv[]){
int i;
printf("Starting array ");
for (i=0;i<10;i++) printf(" %d ",num[i]);
printf("\n");
/* this odes a very efficient quicksort */
qsort(num, 10, sizeof(int), compare);
printf("Ending array ");
for (i=0;i<10;i++) printf(" %d ",num[i]);
return 0;
}
int compare(const * void i, const void * j){
return *(int *)i - *(int *)j;
}