if both arrray are sorted. take two ptrs, one pointing to a[0] other to
b[0]. if elements are same then nt disjoint. else increment ptr pointing to
smaller element until it becomes equal or greater than the element pointed
by other. repeat until either ptr reaches end of array..

On 21 January 2011 21:42, Manmeet Singh <mans.aus...@gmail.com> wrote:

> how merge sort ?/
>
>
> On Thu, Jan 20, 2011 at 11:23 PM, nishaanth <nishaant...@gmail.com> wrote:
>
>> Ya as Ashish said hashing is the best solution :)
>>
>>
>> On Fri, Jan 14, 2011 at 6:00 PM, Ashish Goel <ashg...@gmail.com> wrote:
>>
>>> ideally, a hashMap would be preferred
>>>
>>> walk through one array and set the corresponding entry, and then through
>>> another array, if any entry found, then they are not disjoint.
>>>
>>> Best Regards
>>> Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>>
>>> On Fri, Jan 14, 2011 at 3:35 PM, bittu <shashank7andr...@gmail.com>wrote:
>>>
>>>> how to find if two arrays of size n are disjoint or not in O(n)
>>>> time ?? You can use only O(n) space............
>>>> The elements are +ve in the range 0 to n power 100..........
>>>>
>>>>
>>>>
>>>> Regards
>>>> Shashank Mani
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> S.Nishaanth,
>> Computer Science and engineering,
>> IIT Madras.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to