Some very nice approaches have been presented but I still feels for
practical situations its better to sort and compare......All other
algorithms presented above restricts the max value for an element in the
array.In case the maximum value is small,we can simply count sort,and the
algorithm will still be O(N) (Much simpler and immune to problems such as
finite word size)


Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Thu, Jan 5, 2012 at 5:17 PM, atul anand <[email protected]> wrote:

> @Shashank :  as i have mentioned in the question , no sorting allowed.
> if question would have allowed sorting then why not sort both array and
> compare it would be much simpler and no need of doing costlier operation
> like finding power.
>
> complexity = O(nogn) + O(mlogm) + O(n)
>
>
>
>  --
> 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.

Reply via email to