@sharad kumar: But don't you think this'll consume a lot of space. Merge
sort will give O(nlogn) complexity when a separate LL is used to store the
sorted elements but if we disbuild the same LL it'll be >O(n2). And also wat
do u mean by combining LL can u explain


On Wed, Jun 2, 2010 at 6:48 AM, sharad kumar <[email protected]>wrote:

> @Raj:sorting can be done in O(nlogn)..sort both and compare both.or use a
> hash map to store all elements of one LL and then compare it with
> other....or combine both the  LL perform merge sort and start deleting
> adjacent elements.if adjacent elements in equal count then LL are equal and
> at end of process we get an empty list.....
>
>
> On Tue, Jun 1, 2010 at 11:55 PM, Raj N <[email protected]> wrote:
>
>> Hi all,
>> Can someone suggest an efficient algorithm to check if 2 linked lists
>> are identical. If 2 lists have to be sorted then there'll be a lot of
>> space consumption for 2 separate linked lists. Can the whole process
>> be done < O(n2)
>>
>> --
>> 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]<algogeeks%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> yezhu malai vaasa venkataramana Govinda Govinda
>
>  --
> 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]<algogeeks%[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