Question: Exercise 4. ALGORITHM DESIGN: A DATING SERVICE. You are running a dating service with three groups of people, A, B and C. Each group has

Exercise 4. ALGORITHM DESIGN: A DATING SERVICE. You are running a dating service with three groups of people, A, B and C. Each group has n individuals. Each individual has answered yes or no to n questions in a questionnaire. For uniformity of notation, let the i-th person's answers in group A be denoted by a vector (A1[i], ..., An[i]], and similarly for B and C, and let all answers be 0 or 1. We define the compatibility between person i in group A and person j in group B as the number of identical answers they gave. Similarly, for a threesome i (from A), j (from B) and l (from C), the compatibility of the threesome is the number of questions on which all three answered in the same manner. (i) Give an algorithm for finding all pairs that have maximal compatibility. In a RAM model, it should take time O(n) with a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
