Why would xoring fail?
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Wed, Jan 4, 2012 at 9:56 AM, SAMM <[email protected]> wrote:

> I think this may works . needs verification.
>
> For the given array (3 5 2 5 2)
> For +ve number (N) take the sum from 1 to N .
> For -ve number (N) take the sum from -1 to N .
> And take take the cumulative sum ... For this array it comes 42 .
> Similarly check the sum for the second array . If it is same then we r
> done .
>
> On 1/3/12, atul anand <[email protected]> wrote:
> > There are two arrays.
> > int arr1[5] = { 3, 5, 2, 5, 2}
> > int arr2[5] = { 2, 3, 5, 5, 2}
> > The arrays will be called similar if they contain same number of elements
> > equally.
> > Write the pseudo code to check this ?
> > not allowed to use sorting and hashtable.
> >
> > naive approach O(n^2)
> >
> > NOTE: Xoring , sum wont work.
> >
> > we can use O(n) space , using index as elements in the array. but if it
> has
> > negative number then it will fail for eg arr1 has -1,...  and arr2 has
> > 1,.....
> >
> > --
> > 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.
> >
> >
>
>
> --
> Somnath Singh
>
> --
> 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