Is there a way to perform a circular bit shift in C#?

后端 未结 6 970
太阳男子
太阳男子 2020-11-29 04:58

I know that the following is true

int i = 17; //binary 10001
int j = i << 1; //decimal 34, binary 100010

But, if you shift too far, t

6条回答
  •  鱼传尺愫
    2020-11-29 05:39

    The most famous application is the solution to the Josephus problem (as discussed in Concrete Mathematics, see http://oeis.org/A006257). This is basically a puzzle with no obvious applications. In this video, I demonstrated connections between the second order Josephus problem and complete balanced trees. It's still not an application, but moving slightly in the right direction.

提交回复
热议问题