array icon indicating copy to clipboard operation
array copied to clipboard

Median/quantile/bottoms*/tops* can be log(n) faster

Open mourner opened this issue 7 years ago • 1 comments

Median/quantile/bottoms*/tops* fully sort the data prior to returning the results, which is O(n log n). However, all those could be O(n) by using a selection algorithm instead.

For an example implementation, see https://github.com/simple-statistics/simple-statistics/pull/146 I also have a fast standalone selection module: https://github.com/mourner/quickselect

mourner avatar Jun 29 '18 19:06 mourner

Of course; I mentioned selection algorithms in the linked notebook. Your contribution would be welcome here! And if not, I’ll do it when I find time. Thanks for the reminder.

mbostock avatar Jun 29 '18 19:06 mbostock