Explain:
we know,
Total Number of 1 bit between 0 to 2^n-1
On = 2^(n-1) + 2*On-1 [Read: Recurrence Relation : How many 1's between 0 to (2^n-1) ]
Vn = 2^n -1
Now,
1. Given n and let T1 = 0
2. Nn = n
3. find i, where v[i]>Nn
4. T1 = o[i-1]
5. MSB_ONE = Nn - v[i-1];
6. T1 = T1+MSB_ONE;
7. Now new, Nn = MSB_ONE-1;
8. break if Nn<=0; otherwise go to step3
we know,
Total Number of 1 bit between 0 to 2^n-1
On = 2^(n-1) + 2*On-1 [Read: Recurrence Relation : How many 1's between 0 to (2^n-1) ]
Vn = 2^n -1
Now,
1. Given n and let T1 = 0
2. Nn = n
3. find i, where v[i]>Nn
4. T1 = o[i-1]
5. MSB_ONE = Nn - v[i-1];
6. T1 = T1+MSB_ONE;
7. Now new, Nn = MSB_ONE-1;
8. break if Nn<=0; otherwise go to step3




