Population count of rightmost n integers

Posted by Jason Baker on Stack Overflow See other posts from Stack Overflow or by Jason Baker
Published on 2010-12-27T00:46:37Z Indexed on 2010/12/27 0:54 UTC
Read the original article Hit count: 173

I'm implementing Bagwell's Ideal Hash Trie in Haskell. To find an element in a sub-trie, he says to do the following:

Finding the arc for a symbol s, requires ?nding its corresponding bit in the bit map and then counting the one bits below it in the map to compute an index into the ordered sub-trie.

What is the best way to do this? It sounds like the most straightforward way of doing this is to select the bits below that bit and do a population count on the resulting number. Is there a faster or better way to do this?

© Stack Overflow or respective owner

Related posts about data-structures

Related posts about haskell