BUCKET_SORT(A, k) Build an array of k empty lists. m = FindMax(A) For i = 0 to A.size do Insert A[i] into Bucket[ ⌊ k*A[i].key/m⌋] EndFor Make A empty For i - 1 to k Sort Bucket[i] with a stable sort Insert Bucket[i] into A in order. EndFor