Hacker News new | past | comments | ask | show | jobs | submit login

Did not realize this: "the median of n integers can be found with just O(n) comparisons."

Must figure this out!




There are a couple linear-time selection algorithms, some randomized and some not. An example of the latter is described here ( http://www.ics.uci.edu/~eppstein/161/960130.html ). The constant factor is non-trivial here (<= 24n comparisons for this one) but for large datasets it will eventually be faster than sorting.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: