COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
seqUtils.h
Go to the documentation of this file.
1
8#ifndef __SEQ_UTILS_H_
9#define __SEQ_UTILS_H_
10
11#include <vector>
12
18namespace seq {
19
39 template <typename T> void flashsort(T* a, int n, int m, int *ctr);
40
50 template <typename T>
51 void makeVectorUnique(std::vector<T>& vec, bool isSorted) ;
52
62 template <typename T>
63 bool BinarySearch(const T* arr, unsigned int nelem, const T & key, unsigned int *idx) ;
64
74 template <typename T>
75 int UpperBound (unsigned int nelem,const T * arr,unsigned int startIdx, const T & key);
76
88 template <typename T>
89 bool maxLowerBound(const std::vector<T> & arr,const T & key, unsigned int & retIdx,
90 unsigned int* leftIdx, unsigned int* rightIdx);
91
92/*
93 template <class T,class StrictWeakOrdering>
94 typename std::iterator_traits<T>::difference_type BinSearch(T A,T A_last,
95 const typename std::iterator_traits<T>::value_type& val,StrictWeakOrdering comp);
96
97 template <class T,class StrictWeakOrdering>
98 void Merge(T A_,T A_last,T B_,T B_last,T C_,StrictWeakOrdering comp);
99*/
100
101}//end namespace
102
103#include "seqUtils.tcc"
104
105#endif
106
Collection of Generic Sequential Functions.
void flashsort(T *a, int n, int m, int *ctr)
Flash sort algo to sort an array in O(n).
void makeVectorUnique(std::vector< T > &vec, bool isSorted)
Removes duplicates from the vector.
int UpperBound(unsigned int nelem, const T *arr, unsigned int startIdx, const T &key)
Finds the index of the smallest upper bound of the search key in the array.
bool BinarySearch(const T *arr, unsigned int nelem, const T &key, unsigned int *idx)
A binary search implementation.
bool maxLowerBound(const std::vector< T > &arr, const T &key, unsigned int &retIdx, unsigned int *leftIdx, unsigned int *rightIdx)
Finds the index of the greatest lower bound of the search key in the array. The implementation uses a...