logoalt Hacker News

The DISTINCT in Your COUNT

17 pointsby gmcabritatoday at 7:40 PM3 commentsview on HN

Comments

muth02446today at 8:12 PM

If you are satisfied with an approximation of "DISTINCT", there is a facinating probabilistic algorithm by Flajolet and Martin

https://en.wikipedia.org/wiki/Flajolet%E2%80%93Martin_algori...

which fits on 10 lines and does not require sorting. Improved versions of it are LogLog and HyperLogLog.

show 1 reply
thecaiotoday at 8:13 PM

Hard to make a case to engange with an AI written article even if not fully slop