Re:Lomuto's Comeback
by cozzyd on Sunday May 17, 2020 @02:51PM
(#23214273)
Yeah, you can histogram the values if you just need an approximate answer (or if you have few enough discrete values, you can just have a bin per value). Once you have an approximate answer, if you need a more precise answer, you can go through the data again and only consider values within the right bin (which hopefully will be a lot fewer, if you've chosen your bins wisely) and then use something like std::nth_element.
[ Parent
| on HN ]
There are no comments on this comment yet.