Hmm,
Divide the coin set into 5 groups,
2+2+2+2+1
Label these group as A,B,C,D and E.
Step 1. Compare A and B
Step 2. Compare C and D
Case 1 : A==B, C==D
implies both heavy and light coins have ended up in the same group
interchange one coin from A with one coin in B &
interchange one coin from C with one coin in D
Step 3. Compare A and B
Step 4. Compare C and D
The heavy and light coins would have been identified by now
Case 2 : A==B, C!=D (WLOG, A!=B and C==D is symmetric to this case)
implication
Case 2.1 Both C and D have one bad coin each
Case 2.2 One of either C or D has a bad coin and the other bad coin is E
Step 3. Take one coin from A and compare with E
This should identify which of the case 2.1 or 2.2 we are handling.
For case 2.1,
First of all, we know which of C and D is heavier or lighter.
Step 4. Compare coins of C against each other
Step 5. Compare coins of D against each other
The heavy and light coin will have been identified by now
For case 2.2,
From Step 3 we know whether E is heavier or lighter and since C!=D, the tilt during this comparison would tell us which is the bad group. If X is the bad group then,
Step 4. Compare coins of X against each other
Case 3 : A!=B and C!=D
Implications,
One of A and B is bad
One of C and D is bad
Step 3. Compare A against C
Step 4. Compare A against D
If A is good (in which case one of A==C or A==D will be true), then we would come to know from these steps which groups are bad and which are heavier or lighter. If A is bad (in which case both A!=C and A!=D will be true), then we would come to know whether A is heavier or lighter and we also would find the other group and also would find out whether it is heavier or lighter.
If X and Y group are found to be bad and we know which of X and Y is heavier or lighter then,
Step 5. Compare coins of X against each other
Step 6. Compare coins of Y against each other
The heavier and lighter coins would have been known by now.
So at the most it seems, we will take 6 comparisons and at the best it can work out in 3 comparisons.
-- AI