Code: Select all
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98
84a516841ba77a5b4648de2cd0dfcb30ea46dbb4
...Code: Select all
86f7e437faa5a
e9d71f5ee7c9
84a516841ba7
...My question is, given a column of hashes (with an appropriate UNIQUE KEY added to them), for any given hash how do I find the shortest unique substring starting from the beginning of the hash? This appears to be a trivial extension to the binary search algorithm, but I can't figure out how one would make it work in SQL, except string matching (which I suspect wouldn't be as fast as it should be).