Please help me on this algorithm I can't figure this out, please help:

Two police oﬃcers are carrying $n$ gold coins in two bins, in a secured
  vehicle. The physical characteristics of the the gold coins are the
  same, but while the coins in the ﬁrst bin are all the same, the ones
  in the second bin are diﬀerent from the ones in the ﬁrst bin. At one
  corner, the driver suddenly brakes and the coins are all mixed up.
  They have a device that can be applied to two coins and tells whether
  they are diﬀerent or not. It is known in advance that most of the
  coins (more then 50% ) are from the ﬁrst bin. Find the algorithm that
  the two oﬃcers should apply in order to put the coins back into the
  bins. How many comparisons are necessary, in the worst case, to ﬁnd at
  least one coin from the ﬁrst bin?
(Beware: it is possible that two coins are identical, but do not
  belong to the ﬁrst bin.)

I don't understand - so the first bin has same coins and coins in the second bin are different than the first bin, but different to each other too?
 A: This might not be the fastest. But this is a hint to help you get started thinking about the problem.
Start with two piles of coins $S_1$ and $L_1$. One pile is empty ($S_1$) the other has all the coins ($L_1$).
Let $n=1$
1) Pick a coin $A_n$ form the larger pile $L_n$.
2) Compare that coin to all the other coins in $L_n$ and make two new piles piles.
3) When you are done, call the smaller of the two new piles $S_{n+1}$ and the larger $L_{n+1}$
4) You can easily see if $A_n$ is from the first bin (Is $A_n$ the same as those in the larger pile $L_{n+1}$?). If it is you are done.
5) If $A_n$ is not from the first bin then all the first bin coins are in $L_{n+1}$ and you then increase $n$ by one.
6) Goto 1.
A: The goal is to create two piles each with
one type of coin.
Call the piles A and B.
Compare two coins.
If they are the same, put one of them a holding pile
and continue comparing
a new coin until they differ.
(Since there are coins of both types, 
this will happen eventually.)
Put the new coin in the A pile and
the other coin and the coins in the holding pile
into the B pile.
At this point, there is least one coin
in each pile.
Choose a coin the A pile.
For each remaining coin,
compare it with the chosen coin
and put it into the
A pile if they are the same,
and the B pile if they differ.
At all times, keep a count of the number of coins in the A and B piles.
At the end, the pile with the
larger number of coins goes into the first bin,
and the other pile goes into the second bin.
As for the number of comparisons,
each coin is compared once,
except for the first two,
so the number of comparisons
is the number of coins minus 1.
The worst case for finding a coin from the first bin
(the majority bin)
is that only coins from the second bin are compared until they are all used.
If there are n in bin 1 and m in bin 2,
with n > m,
then m comparisons might be needed,
m-1 for all in bin 2 and 1 for one in bin 1.
If there are N = 2M+1 total coins,
m might be as large as $M = \lfloor N/2\rfloor= \lfloor(N-1)/2\rfloor$.
If there are N = 2M total coins,
to have n > m, $m \le M-1 = \lfloor(N-1)/2\rfloor$.
In either case, if there are N total coins,
the maximum number of comparisons to get a coin of each type is 
$\lfloor(N-1)/2\rfloor$.
However, we do not know
until more than half the coins are
in one of the piles which pile represents bin 1 or bin 2.
The worst case is that there are an odd number of coins
with the number in bin 1 one more than
the number in bin 2
and they match up until the last one.
In this case, all coins have to be compared.
