This is the well know select algorithm. see http://en.wikipedia.org/wiki/Selection_algorithm.
I need it to find the median value of a set of 3x3x3 voxel values. Sinc
My super fast algorithm for calculation of median of a 1-D data set does the job in three passes and doesn't need to sort (!!!) the data set.
A very generic description is as follows:
The algorithm is designed for finding medians of extremely large 1-D data sets greater then 8GE ( giga elements ) of Single-Precision Floating Point values ( on a desktop system with 32GB of physical memory and 128GB of virtual memory ), or for finding medians of small data sets in a hard real-time environment.
The algorithm is:
Best regards, Sergey Kostrov