@ Raj, Just to clarify, same elements refer to copy of identical data or link list members pointing to same data ?
On Wed, Jun 2, 2010 at 10:47 PM, Raj N <[email protected]> wrote: > @Antony: The 2 lists should have the same elements as well the number must > be equal > > > On Wed, Jun 2, 2010 at 5:38 PM, Antony Vincent Pandian.S. < > [email protected]> wrote: > >> @Raj >> >> What do you mean by identical? You are just concerned about the >> presence of one element in another LL or you are concerned about the >> equality of number of elements too? >> >> On 6/2/10, Raj N <[email protected]> wrote: >> > @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]> >> <algogeeks%[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]> >> <algogeeks%[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]<algogeeks%[email protected]> >> . >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> > >> >> -- >> Sent from my mobile device >> >> Luv, >> S.Antony Vincent Pandian >> >> -- >> 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]<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.
