@Kunal: complexity is O(log n).  because for a number n, its binary
representation requires log n to the base 2 no. of bits and hence to check
whether
a given no. is palindrome would require us to scan all the bits and hence
the time complexity would be O(log n)


regards,
Ankit


On Tue, May 24, 2011 at 10:32 AM, Kunal Patil <[email protected]> wrote:

> @Piyush:
> I don't think 1010 (and any even number) will be a binary palindrome
> (Unless u allow single leading zero)...(Either you allow all or allow none)
> If its not so what about 1001 then ? Whether it will be a palindrome or not
> ?[?]
>
> Don't you think, it isn't possible to do this in less than O(n) as we have
> to look at each bit at least once to confirm that given binary number is
> palindrome ?
> If O(n) is permitted then Logic used in immanuel's solution looks correct
> to me..
>
> Any1 having other logic which may have less comparisons ??
>
> --
> 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.
>

-- 
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.

<<363.gif>>

Reply via email to