| 229 | |
| 230 | private: |
| 231 | void ShellSortInternal(std::vector<int>& subitems, size_t d) const |
| 232 | { |
| 233 | for (size_t i = d; i < subitems.size(); ++i) |
| 234 | { |
| 235 | // Take the next item |
| 236 | for (size_t j = i + 1; j >= d + 1; j -= d) |
| 237 | { |
| 238 | // Check the current item with the previous one |
| 239 | if (subitems[j - 1] < subitems[j - d - 1]) |
| 240 | std::swap(subitems[j - 1], subitems[j - d - 1]); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | }; |
| 245 | |
| 246 | class MergeSort : public CppBenchmark::Benchmark, public SortFixture |