in reply to Help thinking about an alternate algorithm

Maybe if you encode each category as a set of bits, and combine those bits into bit strings, the individual comparisons reduces to a matter of xoring the pairs of strings and counting the number of bits in the result.

That should prove to be substantially faster than 5 to 10 individual subtractions and summing of the results.

But I think the best you can hope for is to improve the per-pair comparison cost; rather than there being any way to reduce the number of per-pair comparisons that must be done. (I think :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Help thinking about an alternate algorithm

Replies are listed 'Best First'.
Re^2: Help thinking about an alternate algorithm
by Limbic~Region (Chancellor) on Jan 15, 2014 at 16:55 UTC
    BrowserUk,
    I have already maximized the efficiency in determining the distance between two selections using bitmasks. As stated, I know that full cross comparison is necessary in some cases. I was just hoping that I could prune that full cross comparison in cases where I knew a compare couldn't lead to a higher distance than I already have. There is one trivial case where this short circuiting works (when 2 items are the maximum distance possible). I was hoping there might be others assuming the data will be mostly similar.

    Cheers - L~R

      There is one trivial case where this short circuiting works (when 2 items are the maximum distance possible).

      "two items"? Are items people? Or categories?

      What is the "maximum distance"? No categories the same. How can you know that until you have compared all categories for the given pair? What are you short circuiting?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.