7
1
I've been doing a lot of research about bitcoin, trying to understand it at the bit & byte level.
I was wondering about the lookup efficiency of the Merkle tree.
I haven't found any evidence that Merkle trees are mandatory binary, which would allow a O(log2 n) lookup algorithm.
If a node may have an arbitrary number of children, then the lookup function would have a O(logK n * K), where K is the maximum number of allowed child nodes (as far as I remember).
Just to clarify a possible misunderstanding: "binary Merkle trees" (in Bitcoin blocks) are not used for looking up transactions. They're used to construct proofs that a transaction is contained within a block, in as few bytes as possible. Murch's answer goes into more detail. – Jannes – 2016-01-28T17:40:14.690