hashtable - Bit Array with Find Max -


so bit arrays , hash tables don't seem inherently allow find-max type operation, there ways around it. i'm wondering if there's way using bit array alone without variables, pointers, or manipulating start/end of array, in scenarios. example...

i have integers {1,...,n} , n-bit bit array. keep subset of integers, use integer key in bit array , set bit 1 if in subset, or 0 if not.

for example integers {1,2,3,4} , subset {1,3), bit array {1,0,1,0}.

it seems there's no way without somehow moving bits around leads me believe o(1) dream dead , perhaps bit array won't work. possible in o(log n)?

thanks

finding highest set bit on bit array of length n o(n). if need better, you'll need choose data structure, or keep high-water mark along bitmap.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -