I was looking at the brute force algorithm, and I was wondering why we used >>, arithmetic shift rather than >>>, logical shift. If we are looking for the number of bits in the number, does that include the signed bit? If we shift with >>, then we create another 1 every time we shift.
5-1 Parity >> vs >>>
I think you are right, in this situation, logical shift is more appropriate because arithmetic shift may cause incorrect result. Thanks for your excellent discussion and please keep doing this.
0 Likes