I’m new to the concepts of TC and SC. Please correct if I’m wrong but Should the Time complexity of the solution of Count Set bits problem be O(1) or O(log n)?
It’s my understanding that dividing an integer by 2 repeatedly until it reaches 0 is of O(log n) time complexity where logarithm is of base 2. It is also my understanding that Bit manipulation has Constant time complexity. But since we repeatedly use right bit shift which is same as dividing the number by 2, Should we consider that TC is O(log n)?