Hi,
   Well u state that
   "With n ones..
1. Use first n-1 ones to reach 2^(n-1) - 1
2. Set 2^(n-1) th one.
3. Reverse the first step.
4. Now use the n-1 ones to set the next 2^(n-1) - 1 ones!"
  According to this logic, you have set the 2^(n-1)th one alone with n ones
 Now check if your logic is right for setting the 4th (2^(3-1)) one with 3 ones (n) is this working
 U can see that when u are reversing the first step, you will need more than 3 ones at a time in the array
just check and tell
-karthik

 

Reply via email to