When BTC is traded at a Bitstamp, Mt Gox (or similar) what is the algorithm for matching Buys to Sells? How do partial fills occur? I'm trying to understand how a partial fill would / should happen at an exchange and how that would occur

For example, if the BTC rate was $10/BTC and 


Someone wanted to buy 100 BTC at $10 


The only sellers were 


One seller wants to sell 50 coins for $10 USD
One seller wants to sell 50 coins for $9.90 USD


Question


Would the final transaction not be completed because not enough matching shares were available?  (fair benefit)
Would the purchaser be charged $10 * 50 + $9.90 * 50 = $995  (purchaser saves $5)
Would the purchaser be charged $1,000 and the price was increased from $9.90 to $10 (seller gains unexpected $5)
Would the exchange purchase the shares at $9.90 and quickly resell them for $10  (exchange benefit)
If #4 occurs, should the exchange still charge a fee on top of profits already made?


What is expected in this scenario?

To put this in better context, I'm comparing #4 to SEC Rule 605 to encourage open reporting and trade equality.  Namely requiring market centers (Mt Gox) to disclose the extent to which they provide executions at prices better than the public quotes to investors using limit orders.
(2) is the correct answer, the exchange will match the buy order with the lowest sell orders. This is the case with mtgox. Other exchanges should do the same, however it is up to them, hard to give a general answer here, need to look at each one case by case

(4) is specifically NOT true in case of mtgox because they do not act as counter party to any transaction. Not sure about any other exchange, because they all have their own policies.