MCPcopy Create free account
hub / github.com/Gecode/gecode / partition

Function partition

gecode/support/sort.hpp:112–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 /// Standard partitioning
111 template<class Type, class Less>
112 forceinline Type*
113 partition(Type* l, Type* r, Less &less) {
114 Type* i = l-1;
115 Type* j = r;
116 Type v = *r;
117 while (true) {
118 while (less(*(++i),v)) {}
119 while (less(v,*(--j))) if (j == l) break;
120 if (i >= j) break;
121 std::swap(*i,*j);
122 }
123 std::swap(*i,*r);
124 return i;
125 }
126
127 /// Standard quick sort
128 template<class Type, class Less>

Callers 3

base.hppFile · 0.85
opt.hppFile · 0.85
quicksortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected