Bucket Sort
1. function BucketSort(A){
2.      B = new Array(A.length);
3.      k = 0;
4.      for(var i = 0; i < A.length;i++){
5.           index = Math.floor(A[i]*10);
6.           insertList(index,A[i]);
7.           }
8.      A = new Array();
9.      for(var i = 0; i < B.length; i++){
10.           if(B[i] != undefined){
11.                B[i] = InsertionSort(B[i]);
12.                A = A.concat(B[i]);
13.                }
14.           }
15.      }
16.      
17. function insertList(index,x){
18.      if(B[index] == undefined){
19.           B[index] = new Array();
20.           B[index][0] = x;
21.           }
22.      else
23.           B[index].push(x);
24.      }
25.
26. function InsertionSort(A){
27.      var key;
28.      for(var j = 1; j < A.length; j++){
29.           key = A[j];
30.           var i = j - 1;
31.           while(i >= 0 && A[i] > key){
32.                A[i + 1] = A[i];
33.                i--;
34.                }
35.           A[i + 1] = key;
36.           }
37.      return A;
38.      }