Re: [algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread Ravi Ranjan
i got my mistake..
den how to fulfill all the conditions??

-- 
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.



Re: [algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread atul anand
@Ravi : if your solution is acceptable then there is no need ok modifying
data structure.
we can use hashMap which table address and count as an input.

then we can move in same fashion as you have mentioned , if count is of
given address is 1 then it means that address is the intersection point.




On Thu, Dec 15, 2011 at 10:19 PM, atul anand wrote:

> @Ravi : your solution will not work for all the cases because of the
> restriction
> *
> *
> *1)You should not traverse to the end any of the linked list.*
> *
> *
> now consider one linked list to be very large while other is very small
> say 1/5 of the large one.
>
> now because second linked list is short and it will reach to the end of
> the linked list before first linked list has reached the intersection point
> hence it violates the rule.
>
> On Thu, Dec 15, 2011 at 8:56 PM, Ravi Ranjan wrote:
>
>> in the link list take another variable suppose toggle and initialize all
>> with 0,,, at the time of declaring the link list( so no traversal of
>> entire link list).. now starting from both head traverse a single element
>> at a time but in alternating way... for one linklist the toggling value is
>> set to 1, while another linklist sets its next element value to 2, now
>> for any one of the list that reaches to the merge point.. will change its
>> value either by 1 or 2.. when the other one reaches the junction and if it
>> finds  a non zero b\value then will confirm it wil be the junction so
>> without traversing the entire linklist one can determine the merge point
>>
>>> --
>>>
>>
>> Ravi Ranjan Sinha
>> final yr
>> computer science
>> NIT Jalandhar
>>
>>>  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.
>>>
>>
>>  --
>> 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.
>>
>
>

-- 
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.



Re: [algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread atul anand
@Ravi : your solution will not work for all the cases because of the
restriction
*
*
*1)You should not traverse to the end any of the linked list.*
*
*
now consider one linked list to be very large while other is very small say
1/5 of the large one.

now because second linked list is short and it will reach to the end of the
linked list before first linked list has reached the intersection point
hence it violates the rule.

On Thu, Dec 15, 2011 at 8:56 PM, Ravi Ranjan wrote:

> in the link list take another variable suppose toggle and initialize all
> with 0,,, at the time of declaring the link list( so no traversal of
> entire link list).. now starting from both head traverse a single element
> at a time but in alternating way... for one linklist the toggling value is
> set to 1, while another linklist sets its next element value to 2, now
> for any one of the list that reaches to the merge point.. will change its
> value either by 1 or 2.. when the other one reaches the junction and if it
> finds  a non zero b\value then will confirm it wil be the junction so
> without traversing the entire linklist one can determine the merge point
>
>> --
>>
>
> Ravi Ranjan Sinha
> final yr
> computer science
> NIT Jalandhar
>
>>  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.
>>
>
>  --
> 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.
>

-- 
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.



Re: [algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread Ravi Ranjan
in the link list take another variable suppose toggle and initialize all
with 0,,, at the time of declaring the link list( so no traversal of entire
link list).. now starting from both head traverse a single element at a
time but in alternating way... for one linklist the toggling value is set
to 1, while another linklist sets its next element value to 2, now for
any one of the list that reaches to the merge point.. will change its value
either by 1 or 2.. when the other one reaches the junction and if it finds
a non zero b\value then will confirm it wil be the junction so without
traversing the entire linklist one can determine the merge point

> --
>

Ravi Ranjan Sinha
final yr
computer science
NIT Jalandhar

> 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.
>

-- 
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.



Re: [algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread atul anand
seem like very twisted problem :P :P . lot of restriction.

On Thu, Dec 15, 2011 at 7:30 PM, Ankur Garg  wrote:

> Twisted linked list problem: Two linked lists merge at some node p,both
> the head pointers are given find the merging point under
> the following restrictions.
> 1. You should not traverse to the end any of the linked list.
> 2. Merge node p should be detected by the time you reach at most most k
> nodes from p.
> 3. Space should not exceed by k units.
> 4. No saving of nodes to hard discs.
> 5. No recursion.
>
> Regards
> Ankur
>
> --
> 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.
>

-- 
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.



[algogeeks] Interesting Liked List problem..Suggest Algo

2011-12-15 Thread Ankur Garg
Twisted linked list problem: Two linked lists merge at some node p,both the
head pointers are given find the merging point under
the following restrictions.
1. You should not traverse to the end any of the linked list.
2. Merge node p should be detected by the time you reach at most most k
nodes from p.
3. Space should not exceed by k units.
4. No saving of nodes to hard discs.
5. No recursion.

Regards
Ankur

-- 
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.