Informazioni sulla logica bitmap

0

Stavo andando a questo blog e dice

You can represent a list of distinct integers no larger than N using exactly N bits: if the integer i appears in your list, you set the i th bit to true. Bits for which there is no corresponding integers are set to false. For example, the integers 3, 4, 7 can be represented as 00011001. As another example, the integers 1, 2, 7 can be represented as 01100001.

Qualcuno può spiegarmi come [3, 4, 7] = 00011001 e [1, 2, 7] = 01100001 e anche perché vengono prelevati 8 bit?

    
posta Aniket Thakur 10.12.2013 - 13:30
fonte

1 risposta

4

Pensa a ['0d: OFF', '1st: OFF', '2nd: OFF', '3rd: ON', '4th: ON', '5th: OFF', '6th: OFF', '7: ON'].

    
risposta data 10.12.2013 - 13:35
fonte

Leggi altre domande sui tag