heapsort.hxx File Reference

Header declaring template functions for sorting an array of index-objects indexing an array of value-objects comparable by "<". More...

#include "mymath.hxx"

Go to the source code of this file.

Namespaces

namespace  CH_Tools

Functions

template<class I, class V>
void CH_Tools::heapify (int i, int n, I &ind, const V &val)
 Heapify element i (in 0,...,n-1) in ind, so that afterwards val[ind[j]]>=max(val[ind[2*j+1]],val[ind[2*j+2]] for the subtree with root i.
template<class I, class V>
void CH_Tools::build_heap (int n, I &ind, const V &val)
 Build a heap out of ind[0] to ind[n-1], so that val[ind[j]]>=max(val[ind[2*j+1]],val[ind[2*j+2]] for all j.
template<class I, class V>
void CH_Tools::heapsort (int n, I &ind, const V &val)
 Sort ind[0]...ind[n-1] so that val[ind[i]]<=val[ind[j]] for 0<=i<j<n.


Detailed Description

Header declaring template functions for sorting an array of index-objects indexing an array of value-objects comparable by "<".

Version:
1.0
Date:
2005-03-01
Author:
Christoph Helmberg

Generated on Tue May 3 16:52:53 2011 for ConicBundle by  doxygen 1.5.6