Hacker News new | past | comments | ask | show | jobs | submit login

  I can't see how an algorithm to lookup bit 'i' in a compressed bitmap of size 'n' can ever be constant time.
What you do is decoding a block in constant time, as the block size is constant and you need exactly block size iterations.

Accessing the i-th bit cannot be done in constant time as I already mentioned unless you also store all the offsets (including all-zeros/ones). In that case, all you have to do is moving to the i/b block (where is is the position you want to access and b is the block size) by skipping (len(C)+len(O)) * i/b bits.




But to decode a block of size 'b' takes O(b), i.e. larger blocks take longer to decode. You can pick whatever size block you like, but smaller blocks lead to less compression. It's just another form of indexing.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: