Hi,,
Think the No of 1 bits can be found in o(k) where k is the no of bits
set
while((n & (n-1)) >= 0)
{
c++;
n = n & (n-1);
printf(">> n %d Cnt %d \n",n,c);
if(!n)
break;
}
printf("Cnt %d \n",c);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---