I was looking at Kademlia's paper, and I had a problem I couldn't understand.
In a fully-populated binary tree of 160-bit IDs, the magnitude of the distance between two IDs is the height of the smallest subtree containing them both.
d(101,010) = 5 ^ 2 = 7
but Lowest Common Ancestor height is 4:Count from one or 3:Count from zero (root)
This result is obviously wrong, and I must have something wrong, so how should I interpret this sentence I am looking forward to your reply. Thank you
Pseudo Reliable Broadcast in the Kademlia P2P System
Kademlia, in turn, organizes its nodes to a binary tree. (For an in-depth discussion of the internal mechanisms of Kademlia, please refer to [2].) Distance between nodes is calculated using the XOR (exclusive or) function, which essentially captures the idea of the binary tree topology. For any nodes A and B, the magnitude of their distance d(A,B)=AB, e.g. the most significant nonzero bit of d is the height of the smallest subtree containing both of them.
Kademlia: A Peer-to-peer Information System Based on the XOR Metric
We next note that XOR captures the notion of distance implicit in our binarytree-based sketch of the system. In a fully-populated binary tree of 160-bit IDs, the magnitude of the distance between two IDs is the height of the smallest subtree containing them both. When a tree is not fully populated, the closest leaf to an ID x is the leaf whose ID shares the longest common prefix of x. If there are empty branches in the tree, there might be more than one leaf with the longest common prefix. In that case, the closest leaf to x will be the closest leaf to ID x˜ produced by flipping the bits in x corresponding to the empty branches of the tree.