Generated on Wed Nov 1 15:04:56 2006 for Gecode by doxygen 1.4.5

Support algorithms and datastructures
[Common functionality]

Collaboration diagram for Support algorithms and datastructures:


Detailed Description

These are some common datastructures used in the implementation of Gecode. Maybe they can be also useful to others.

In order to use them, one needs to include the appropriate header-file as described in the class and function documentation.


Classes

class  Gecode::Support::BlockAllocator< T >
 Manage memory organized into block lists (allocator). More...
class  Gecode::Support::BlockClient< T >
 Client for block allocator of type T. More...
class  Gecode::Support::DynamicArray< T >
 Array with arbitrary number of elements. More...
class  Gecode::Support::DynamicStack< T >
 Stack with arbitrary number of elements. More...
class  Gecode::Support::LinearCongruentialGenerator< m, a, q, r >
 Template for linear congruential generators. More...
class  Gecode::Support::SharedArray< T, fd >
 Shared array with arbitrary number of elements. More...
class  Gecode::Support::PQueue< T, Less >
 Simple fixed-size priority queue. More...
class  Gecode::Support::StaticStack< T >
 Stack with fixed number of elements. More...

Typedefs

typedef LinearCongruentialGenerator< 2147483647, 48271, 44488, 3399 > Gecode::Support::RandomGenerator
 Default choice of values for the linear congruential generator.

Functions

template<class Type, class LessThan>
void Gecode::Support::insertion (Type *x, int n, LessThan &lt)
 Insertion sort.
template<class Type, class LessThan>
void Gecode::Support::quicksort (Type *x, int n, LessThan &lt)
 Quicksort.


Typedef Documentation

typedef LinearCongruentialGenerator<2147483647, 48271, 44488, 3399> Gecode::Support::RandomGenerator
 

Default choice of values for the linear congruential generator.

While this pseudo-random number generator is not a good source of randomness, it is still an acceptable choice for many applications. The choice of values is taken from D. E. Knuth, The Art of Computer Programming, Vol 2, Seminumerical Algorithms, 3rd edition.

Requires

Definition at line 94 of file random.hh.


Function Documentation

template<class Type, class LessThan>
void Gecode::Support::insertion Type *  x,
int  n,
LessThan &  lt
[inline]
 

Insertion sort.

Sorts by insertion the n first elements of array x according to the order lt as instance of class LessThan. The class LessThan must implement the single member function

 bool operator()(const Type&, const Type&) 
for comparing elements.

The algorithm is largely based on the following book: Robert Sedgewick, Algorithms in C++, 3rd edition, 1998, Addison Wesley.

Requires

Definition at line 158 of file sort.hh.

template<class Type, class LessThan>
void Gecode::Support::quicksort Type *  x,
int  n,
LessThan &  lt
[inline]
 

Quicksort.

Sorts with quicksort the n first elements of array x according to the order lt as instance of class LessThan. The class LessThan must implement the single member function

 bool operator()(const Type&, const Type&) 
for comparing elements.

The algorithm is largely based on the following book: Robert Sedgewick, Algorithms in C++, 3rd edition, 1998, Addison Wesley.

Requires

Definition at line 181 of file sort.hh.