Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • Hi Erik, Thanks a lot for your time. Algorithm seems promising. I am having a bit difficulty in understanding some parts. For example, first iteration of Step 3 may be: A1: S1, S3 masking of S1 = 1 masking of S3 = 100 we take OR of these 2 values and that is: 101 which means consider solution of taking S1 and S3. Now what does "Reject all Candidates at that mask" means? Once again, thanks a lot. It was really helpful. Commented Jan 15, 2018 at 16:14
  • Ok, at the high level, since A1 has S1 and S3, that means that S1 and S3 are mutually exclusive solutions by your business logic. So, we cannot consider any solution that has both S1 and S3 together. At the bit level, any Candidiate# that matches 1x1 must then be ruled out. That means ruling out both 101 and 111. Commented Jan 15, 2018 at 16:32
  • Let's say there's two more matches (4. and 5.). Now the Match#'s bit vectors are 5 bits. A1: S1, S3 is 00101. So again, we have to rule out all Candidates where S1 & S3 are together, which is all Candidates that match the pattern xx1x1. This means ruling out Candidate#'s: 00101, 00111, 01101, 01111, 11101, 11111. This is what algorithm with & and == above does. Commented Jan 15, 2018 at 16:34
  • Hi Erik, apologies for not making my question clear. Although, I get it now. It looks great. Thanks a million. And your last comment helped me to understand some other points also. Commented Jan 15, 2018 at 16:36
  • Is my understanding correct that finally we select a set with highest score. Which means there will be one answer. (1 set will be selected). And do you think, same algorithm will work, if we add another Set such that S4:{A2, B1} ? Now Set 4 contains elements which do not appear in any other set. Commented Jan 15, 2018 at 16:38