Problem hav been solved u all giving same answers..! On Thu, Jan 6, 2011 at 11:30 PM, nishaanth <[email protected]> wrote:
> for 2nd question..... > > Let m1,m2 be the length of sll1 and sll2.. > > now we know that after the merge no of nodes are same in both the slls. > > So take the difference , k= m1 - m2 > > skip k nodes frm the longer lists, then increment both sll1 and sll2 till > you find a match. > > The matched node is the required answer. > > > On Thu, Jan 6, 2011 at 11:14 PM, Tushar Bindal <[email protected]>wrote: > >> I agree >> But my doubt is that whether we have to find that they just have their >> last node as common or they can have many nodes common(which I was calling >> intersecting) >> >> >> On Thu, Jan 6, 2011 at 11:07 PM, Naveen Kumar <[email protected] >> > wrote: >> >>> How can two list just intersect, each node can have one pointer to the >>> next. So, if they intersect they will definitely be merging. >>> >>> On Thu, Jan 6, 2011 at 11:01 PM, Tushar Bindal <[email protected]>wrote: >>> >>>> Is it necessary that the two lists are merging at their ends?? >>>> Do we have to find whether they merge at the end into same lists or >>>> wheter they are just intersecting?? >>>> >>>> >>>> >>>> On Thu, Jan 6, 2011 at 10:04 PM, Aditya <[email protected]> wrote: >>>> >>>>> There are two aspects here for second question. >>>>> 1. to find if the common node exist (ie the lists are merging) with out >>>>> the limitation of length available. >>>>> 2. To find the merging node. >>>>> >>>>> >>>>> >>>>> On 1/6/2011 8:49 PM, Naveen Kumar wrote: >>>>> >>>>> @ Vishal, >>>>> I think question says that its merging at a point. >>>>> But anyway can you tell me how to detect cycle in this case. >>>>> >>>>> On Thu, Jan 6, 2011 at 7:57 PM, vishal raja <[email protected]>wrote: >>>>> >>>>>> @aditya, >>>>>> Who said it's a Y shaped structure, It can very well has a cycle. >>>>>> Assume the case when the last node is not pointing to NULL but to a >>>>>> node in the list. >>>>>> >>>>>> >>>>>> >>>>>> On Thu, Jan 6, 2011 at 7:45 PM, ADITYA KUMAR <[email protected]>wrote: >>>>>> >>>>>>> @vishal >>>>>>> saurabh is right >>>>>>> its merging at only one point its a Y-shaped structure >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Thu, Jan 6, 2011 at 7:29 PM, vishal raja >>>>>>> <[email protected]>wrote: >>>>>>> >>>>>>>> >>>>>>>> @sourabh, >>>>>>>> In addition to your solution, If there is any cycle(loop) exist in >>>>>>>> the link list your algo will fail. >>>>>>>> To solve this problem first detect this cycle if there is any and >>>>>>>> count the element in the cycle, and then you can do the mathematics. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Jan 6, 2011 at 6:51 PM, sourabh jakhar < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> for second question calculate the difference in length of two >>>>>>>>> linked list. >>>>>>>>> and than shift the head of longest linked list to the calculated >>>>>>>>> difference. while the head of shorest is at the first node of that >>>>>>>>> linked >>>>>>>>> list. >>>>>>>>> Than iterate both to see if info is equal and that is the merging >>>>>>>>> point. >>>>>>>>> complexity-o(n). >>>>>>>>> hope this help >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Jan 6, 2011 at 6:48 PM, juver++ <[email protected]>wrote: >>>>>>>>> >>>>>>>>>> Yes, but recursion stack's size is limited instead of iterative >>>>>>>>>> version. >>>>>>>>>> -- >>>>>>>>>> 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. >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> SOURABH JAKHAR,(CSE)(3 year) >>>>>>>>> ROOM NO 167 , >>>>>>>>> TILAK,HOSTEL >>>>>>>>> 'MNNIT ALLAHABAD >>>>>>>>> >>>>>>>>> >>>>>>>>> The Law of Win says, "Let's not do it your way or my way; let's >>>>>>>>> do it the best way." >>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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. >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Regards >>>>>>> Aditya Kumar >>>>>>> B-tech 3rd year >>>>>>> Computer Science & Engg. >>>>>>> MNNIT, Allahabad. >>>>>>> >>>>>>> -- >>>>>>> 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. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Cheers >>>>> Naveen Kumar >>>>> -- >>>>> 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. >>>>> >>>>> >>>>> -- >>>>> Regards Aditya >>>>> >>>>> -- >>>>> 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. >>>> >>> >>> >>> >>> -- >>> Cheers >>> Naveen Kumar >>> >>> -- >>> 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. >> > > > > -- > 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 [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. > -- Sanchit Mittal Second Year Undergraduate Department of Computer Engineering Delhi College of Engineering ph- +919582414494 -- 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.
