-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquicksort.h
More file actions
32 lines (21 loc) · 870 Bytes
/
quicksort.h
File metadata and controls
32 lines (21 loc) · 870 Bytes
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
/* Copyright (c) 2007 the authors listed at the following URL, and/or
the authors of referenced articles or incorporated external code:
http://en.literateprograms.org/Quicksort_(C_Plus_Plus)?action=history&offset=20070928075422
Retrieved from: http://en.literateprograms.org/Quicksort_(C_Plus_Plus)?oldid=10979
*/
// Adding comment line
#ifndef QUICKSORT_H
#define QUICKSORT_H
#include <iostream>
#include <algorithm> // std::swap()
#include <vector>
template<typename IT> IT partition(IT begin, IT end, IT pivot);
template<typename IT> IT pivot_median(IT begin, IT end);
template<typename IT> struct pivot_random {
pivot_random();
IT operator()(IT begin, IT end);
};
template<typename IT, typename PF> void quick_sort(IT begin, IT end, PF pf);
template<typename IT> void quick_sort(IT begin, IT end);
template<typename T> void print(const T &data);
#endif