To reverse the bits of a 32-bit integer, iterate through all 32 positions. At each step, extract the lowest bit of the input using AND with one, shift it left to its reversed position which is 31 minus the current position, OR it into the result, and right-shift the input by one to process the next bit. After 32 iterations, the result contains all bits in reversed positions. This runs in O of one time since the number of bits is fixed at 32. An optimized approach divides and conquers by swapping adjacent bits, then pairs of two, then groups of four, eight, and sixteen in five operations.
---