C++ 桶排序(BucketSort)

一、思路      是将[0,1]区间划分为n个等长的子区间。然后,将各个元素按照自己所属的区间放入相应的桶中,只需要将每个桶的元素排好序,依次输出各个桶内的元素,就得到了有序的元素序列。 二、实现程序: #include <iostream> using namespace std; const int offset = 105; // 为桶的边界 const int maxSize = 10
相关文章
相关标签/搜索