What shape of merkle tree does the Bitcoin client build? The Bitcoin client builds a merkle tree to represent the transactions, then includes the root of that tree in the block header.

But usually, the number of transactions is not a power of two. When that happens, how does the Bitcoin client represent the transactions in the tree?

If I wrote a custom mining client, which built a tree with a different "shape," (example below) what would happen?
When the number of transactions is not a power of two, how does the Bitcoin client represent the transactions?
Each time around, it hashes each transaction with the one next to it, until there's only one left.

If there's an odd number of transactions, the last one is hashed again.

In this example, we start out with 11, then 6, then 3, then 2, then 1.

What would happen if you made a differently-shaped merkle-tree?
When sending blocks around, there's no way to specify the shape of the merkle tree. If it's different, the standard client will just reject it.