i/p o/p
==== ===
0(00) 0
1(01) 1
2(10) 1
3(11) 2
..... ...
int count_bit_set(unsigned int b)
{
int count =0;
while(b) {
b = b & (b-1);
count++;
}
return count;
}
Subscribe to Post Comments [Atom]
July 2005 August 2005 October 2005 December 2005 March 2006 June 2006 July 2006 December 2006 February 2007 June 2007 March 2010 May 2010
Subscribe to Posts [Atom]