Implementation of the bucket sort