that will result into an infinite loop,

On Mon, Mar 29, 2010 at 9:51 PM, Umer Farooq <the.um...@gmail.com> wrote:

> that's why i have a terminating condition. It will keep on iterating until
> ((N2 != head)&&(N2->NextPtr != head)) is true.
>
> head pointer of the linked list will be passed as an argument to the
> function.
>
>
> On Mon, Mar 29, 2010 at 7:04 AM, Navin Naidu <navinmna...@gmail.com>wrote:
>
>> @Umer: Its a singly LL and it has cycle. Both N1 and N2 will keep
>> traversing within the cycle.
>>
>>
>>
>> On Sun, Mar 28, 2010 at 9:56 PM, Umer Farooq <the.um...@gmail.com> wrote:
>>
>>> I'll appreciate comments on the solution proposed by me. It works the
>>> following way:
>>>
>>> take two pointers, N1 and N2 pointing on the head of the list.
>>>
>>> Move N2 by two nodes, and N1 by a single node.
>>>
>>> When N2 reaches head again (or N2->Next is a head)
>>>
>>> then return N1 which will be pointing to the middle element of the list.
>>>
>>> Regards
>>> Umer Farooq
>>>
>>>
>>> On Sun, Mar 28, 2010 at 2:17 PM, Mukesh Kumar thakur <
>>> mukeshraj8...@gmail.com> wrote:
>>>
>>>> hi! in my opinion we can find the middle element in the singly linked
>>>> which hv the cycle........
>>>> as we know the list doesnt support the concept of cycle coz it has only
>>>> one direction traversal........
>>>>
>>>>> but if we take the case when the list hvng  the no of element equal
>>>>>
>>>> as we hv :
>>>>                      n element in the list
>>>> we hv to find the middle one
>>>>     in genral;;;;;simply we divide it in .........
>>>> n/2; or
>>>> if consider middle elment as a key ;;;;
>>>>          temp->link=null;
>>>>           temp->first=middle
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@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 algoge...@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.
>>>
>>
>>
>>
>> --
>> Thanks & Regards,
>> NMN
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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 algoge...@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.
>



-- 
Thanks & Regards,

- Navin Mohan Naidu

Great Minds Discuss Ideas
    Average Minds Discuss Events
          Small Minds Discuss People

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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