Posted by: The Joker February 6, 2015
Coding Challenge!!! C++
Login in to Rate this Post:     0       ?        

coding challenge for all the pros

use a circular array to create a circular representation for the n-bit number. The cyclic shift operations will change where the first bit starts in the number. The cyclic shift left shifts every bit to the left by one position and the leftmost bit moves cyclically to the vacated rightmost position. Similarly, the cyclic shift right shifts every bit to the right by one position and the rightmost bit moves cyclically to the vacated leftmost position.
example: input (1 1 1 1 0 0 0 0)
output (1 1 1 0 0 0 0 1 )
Read Full Discussion Thread for this article