From: Admin Tensor Date: 2012-05-24T00:01:49+09:00 Subject: Re: Memory-efficient set of Fixnums George Dupre wrote in post #1061810: > 1) generate a database of a couple dozens of millions of Fixnums > (ranging from 0 to 2^32 - 1), while avoiding redundancy > 2) iterate through them > 3) quickly search for the presence of a given Fixnum in the database Hi, For memory efficiency, if you are on Windows, you can use RTensor with type of "unsigned". If not, you can use other memory-efficient structure for 4-byte data (such as NArray, although its "int" is 4-byte signed integer). For quick search, as has been pointed to, you have to store the data in sorted order, so that you can run binary search. If your data are static, it is fine. If your data are dynamic (often insert and remove), then we still need to find another data structure (such as C++ STL Set). Regards, Bill -- Posted via http://www.ruby-forum.com/.