@Dave - Wouldn't your solution also become O(kn) where k = number of bits in the number? In this summation - O(n) + O(n/2) + O(n/4) + ...= O(n) - you would have O(n) appearing 'k' times. Each entry is O(n/ 2^i) where 'i' is the bit position from right to left, starting at 0. The range of 'i' is from 0 to 'k-1' Please correct me if I am wrong.
On Jun 27, 7:29 am, Bhavesh agrawal <[email protected]> wrote: > can anyone plz post the code for this problem -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
