-
Notifications
You must be signed in to change notification settings - Fork 6
/
lomuto_blocked_dual_merge_third_fifth.h++
56 lines (50 loc) · 1.94 KB
/
lomuto_blocked_dual_merge_third_fifth.h++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/******************************************************************************
* blocked_simple.h++
*
* interface for BlockQuicksort simple with median-of-three
*
******************************************************************************
* Copyright (C) 2016 Stefan Edelkamp <edelkamp@tzi.de>
* Copyright (C) 2016 Armin Wei� <armin.weiss@fmi.uni-stuttgart.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <random>
#include <ctime>
#include <cmath>
#include <assert.h>
#include "insertionsort.h"
#include "median.h"
#include "partition.h"
#include "quicksort.h"
namespace lomuto_blocked_dual_merge_third_fifth {
template<typename iter, typename Compare>
void sort(iter begin, iter end, Compare less) {
quicksort::qsort_dual_pivot<partition::Dual_Lomuto_Block_partition_merge_third_fifth>(begin, end, less);
}
template<typename T>
void sort(std::vector<T> &v) {
typename std::vector<T>::iterator begin = v.begin();
typename std::vector<T>::iterator end = v.end();
quicksort::qsort_dual_pivot<partition::Dual_Lomuto_Block_partition_merge_third_fifth>(begin, end, std::less<T>());
}
}