hammingweight Questions

5

Solved

An interesting problem I ran into today: what is the fastest way to count the number of 1s in an n-bit integer? Is it possible to beat O(n)? For example: 42 = 0b101010 => 3 ones 512 = 0b100000...
Birdman asked 23/10, 2009 at 4:11

66

Solved

8 bits representing the number 7 look like this: 00000111 Three bits are set. What are the algorithms to determine the number of set bits in a 32-bit integer?
Harping asked 20/9, 2008 at 19:4

© 2022 - 2024 — McMap. All rights reserved.