bucket sort with O(n) space