I was reading antirez.com and Wikipedia and some other sources to understang what HLL is and how it works, but each time the term "Leading Zeroes" is used I stumble. Please explain what it means when we talk about HyperLogLog.
Asked
Active
Viewed 229 times
0
-
What if it just means the same as everywhere else, i.e. zero digits at the beginning of a (often fixed length) number? – Matti Virkkunen Dec 02 '14 at 13:00
-
@MattiVirkkunen a number only have leading zeroes if it was represented as string. Then I ask, what is this number and how and why it was converted to a string with so many leading zeroes. – exebook Dec 02 '14 at 13:04
-
Do you consider fixed length numbers strings? A 32-bit integer for instance can have leading zeros and I wouldn't consider it a string. – Matti Virkkunen Dec 02 '14 at 13:05
-
@MattiVirkkunen "The other part of the hash is used to count the longest run of leading zeroes in the hash" whatever it means – exebook Dec 02 '14 at 13:18
-
Hashes are usually fixed length numbers. – Matti Virkkunen Dec 02 '14 at 13:36
1 Answers
1
Leading zeroes is the number of 0s before the first 1 in the binary representation of the hash. It is equivalent to computing the most significant bit.
HyperLogLog algorithm does not really depend on computing these leading zeroes, it just needs to check a known prefix in the binary representation of the hash. It happens that computing the most significant bit is fast on most hardware implementations.

Juan Lopes
- 10,143
- 2
- 25
- 44