silentbicycle / skiparray

unrolled skip list library for C
ISC License
21 stars 2 forks source link

`count_approx(sa, &min, &max)` #5

Open silentbicycle opened 5 years ago

silentbicycle commented 5 years ago

The height and the number of nodes in the top level gives a probabilistic range for how many overall nodes there are, and since all nodes except the last are always at least half full, this gives a range for the overall count without touching most of the structure. This may not be accurate enough to be useful, though. Further experiments are necessary.

It'd have to assume that node level choice follows the default behavior -- half are level 1, half of remaining are level 2, half of remaining are level 3, ... and that a node whose max level is level 4 has roughly 8x as many nodes on level 1.