Research Article

A Splay Tree-Based Approach for Efficient Resource Location in P2P Networks

Algorithm 3

// count the number of significant bits in n
ONES(n)
(1) d 0
(2) while n not 0
(3)  do d d + 1
(4)    & ( )
(5) return d