diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-05-18 07:45:04 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-08-12 14:25:52 +0200 |
commit | 9c4c1c432b27f67eee2ad22ff5f2f9833bd1516d (patch) | |
tree | 7d4e3d23d294aaab7a2979548c4b45ded58ae030 /numpy/doc/glossary.py | |
parent | 0a16937e15af31ac33d76c60d72cdb9c68d7f2f1 (diff) | |
download | numpy-9c4c1c432b27f67eee2ad22ff5f2f9833bd1516d.tar.gz |
ENH: add quickselect algorithm and expose it via partition
A partition sorts the kth element into its sorted order and moves all
smaller elements before the kth element and all equal or greater
elements behind it.
The ordering of all elements in the partitions is undefined.
It is implemented via the introselection algorithm which has worst case
linear complexity compared to a full sort that has linearithmic
complexity.
The introselect algorithm uses a quickselect with median of three pivot
and falls back to a quickselect with median of median of five pivot if
no sufficient progress is made.
The pivots used during the search for the wanted kth element can
optionally be stored and reused for further partitionings of the array.
This is used by the python interface if an array of kth is provided to
the partitions function. This improves the performance of median and
which need to select two elements if the size of the array is even. A
percentile function interpolating between values also profits from this.
String selection is implemented in terms of quicksort which has the same
properties as a selection for now.
Diffstat (limited to 'numpy/doc/glossary.py')
0 files changed, 0 insertions, 0 deletions