no of bits set int v; int c; for(c=0;v;c++) v&=v-1; this is best method without consideration of no of bits in an integer and for executes only the number of times the bit is set in the number//////////////
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.