algorithm - Determine if unique number has been seen from a range of numbers -
i trying find best, quickest , efficient way determine if number has been seen in range.
example: key record: raffle event 1 (database key)
tickets available: 1 - 1000000 (the range)
ticket number 4 turned in. has been turned in event?
ticket number 865401 turned in. has been turned in event?
i've thought bit masks, storing data buckets, etc. none of these seem answer trying find. maybe not exist.
we have 800,000 events, each event 1 million tickets. storing last number turned in, , lower rejected. want have finer granularity, need efficiency , storing each ticket impractical.
data stored using sql
any ideas?
edit
the best idea i've come far using bitmap. have 10 columns each event. each column stores 100,000 bits. should allow quick data retrieval, check if bit on or off. should 1mb of storage per event, or 100k per column read.
i'm still searching alternative ideas or recommendations.
you use bitmask if anticipate range moderate. else try using set structure. these can implemented using binary search trees.
Comments
Post a Comment