Here is an algorithm to determines the number of 1 bits in a given bit string S.
PROCEDURE bit count(S: bit string)
count := 0
while S ≠ 0
count :=count + 1
S := SA (S-1)
end while
return count {count is the number of is in sy S-1 is the bit string obtained by changing the rightmost 1 bit of Sto a 0 and all the 0 bits to the right of this to Is. [Recall that S (S-1) is the bitwise AND of Sand S - 1. Answer the following question
how many bitwise and operations are needed to find the number of 1 bits in a string s using the algorithm ?