How to find the closest pairs (Hamming Distance) of a string of binary bins in Ruby without O^2 issues?

后端 未结 4 2115
迷失自我
迷失自我 2021-02-06 01:13

I\'ve got a MongoDB with about 1 million documents in it. These documents all have a string that represents a 256 bit bin of 1s and 0s, like:

01101010101010101101010101

4条回答
  •  甜味超标
    2021-02-06 02:08

    I ended up doing a retrieval of all the documents into memory.. (subset with the id and the string).

    Then, I used a BK Tree to compare the strings.

提交回复
热议问题