Bit Masking - Important Bit Manipulation Algorithms
If we shift one i times it will become one and if we find fourth bit, four zeros will come we
shifted one four times towards left after that. What I applied this invert operator in our last
video, What invert actually do is it inverts bit zero to one and one to zero.. If you want to
change a into b, you have to change three bits this one, this one and this one. This one so
answer is three. how many times it is one inside this number and that is your answer. Here
one is three times that means you have to change three bits, so it was simple question. now
it is simple just find where it is. how many time one is present inside binary representation.
How many times one is one or how many set bits it has how many. Many. are there in a
binary number.. If you are given a number n, and you have to tell that how many bits will be
present inside its binary representation, so that is log n+1 if you want to know its proof. if you
were given number which is this so you time complexity will become log n Okay! If you
convert it into int you will get floor value so three point something something will become
three and it will become four..
If we shift one i times it will become one and if we find fourth bit, four zeros will come we
shifted one four times towards left after that. What I applied this invert operator in our last
video, What invert actually do is it inverts bit zero to one and one to zero.. If you want to
change a into b, you have to change three bits this one, this one and this one. This one so
answer is three. how many times it is one inside this number and that is your answer. Here
one is three times that means you have to change three bits, so it was simple question. now
it is simple just find where it is. how many time one is present inside binary representation.
How many times one is one or how many set bits it has how many. Many. are there in a
binary number.. If you are given a number n, and you have to tell that how many bits will be
present inside its binary representation, so that is log n+1 if you want to know its proof. if you
were given number which is this so you time complexity will become log n Okay! If you
convert it into int you will get floor value so three point something something will become
three and it will become four..