3#ifndef CUDA_BATTERY_ALGORITHM_HPP
4#define CUDA_BATTERY_ALGORITHM_HPP
14template <
class Seq,
class Compare>
15CUDA int partition(Seq& seq,
int low,
int high, Compare comp) {
18 for (
int j = low; j <= high - 1; j++) {
29template <
class Seq,
class Compare>
30CUDA void quickSort(Seq& seq, Compare comp) {
38 while(stackl.
size() > 0) {
43 int pi = partition(seq, low, high, comp);
59template <
class Seq,
class Compare>
62 impl::quickSort(seq, [&](
int i,
int j) {
return comp(seq[i], seq[j]); });
67template <
class Seq,
class Compare>
70 impl::quickSort(seq, comp);
CUDA void push_back(const T &value)
Definition vector.hpp:248
CUDA void pop_back()
Definition vector.hpp:273
CUDA size_t size() const
Definition vector.hpp:235
CUDA value_type & back()
Definition vector.hpp:230
Definition algorithm.hpp:10
CUDA constexpr void swap(T &a, T &b)
Definition utility.hpp:91
CUDA NI void sort(Seq &seq, Compare comp)
Definition algorithm.hpp:60
CUDA NI void sorti(Seq &seq, Compare comp)
Definition algorithm.hpp:68
Definition utility.hpp:177
#define CUDA
Definition utility.hpp:59
#define NI
Definition utility.hpp:62