/*
 *  SelectionSort
 *
 *  20.11.1998, implemented by Michael Neumann (neumann@s-direktnet.de)
 */

# ifndef __SELECTIONSORT_HEADER__
# define __SELECTIONSORT_HEADER__

# include <algorithm>

template <class itemType, class indexType=int>
void SelectionSort(itemType a[], indexType l, indexType r)
{
	static indexType i, j, min;

	for(i=l; i<r; ++i) {
   	for(min=i, j=i+1; j<=r; ++j) if(a[j] < a[min]) min = j;
      std::swap(a[min], a[i]);
   }
}

# endif