Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • @recursive i think it will work when it reached the call find3even(head+1, tail), which will then crop it to become 111 at head = 4, could you check again for me? Commented Oct 15, 2009 at 3:51
  • @recursive please check the code I added to better explain the pseudo code I made up earlier, which is not very strict and concise Commented Oct 15, 2009 at 3:53
  • This is nlogn - for n bits we expect approximately logn iterations checking n*c bits where C is a constant. Commented Oct 15, 2009 at 19:36
  • Yeah, this seems to fail on 111001 and 100111 as the simplest cases. The evenly spaced 1's don't have to center on the middle bit. Commented Oct 15, 2009 at 19:53
  • It handles those cases correctly, 111001 has an even number of bits so it is immediately split into 111 and 001. Since 111 has an odd number of bits and the middle bit is one it returns successfully. Commented Oct 15, 2009 at 20:06