Algorithm to find the object with different weight

Viewed 391

We are given N objects, out of which exactly one object is of different weight(can be less or more). Also, we are given M comparisons of the following 3 types -

  1. Weight(Set A) < Weight(Set B)
  2. Weight(Set A) > Weight(Set B)
  3. Weight(Set A) = Weight(Set B)

Where Set A and Set B (both have same number of objects) are a list of objects from the initial N objects.

Given M such comparisons, I need to find the object with different weight if possible. Otherwise tell that the given list of M comparisons isn't sufficient to detect the one with different weight.

Can somebody suggest an algorithm for solving this problem?

3 Answers
Related