@SVIX
group members still can post the questions they consider good, doesnt matter
they were able to solve it or not. There can be many ways to solve the same
question.
On Fri, Jan 7, 2011 at 12:39 AM, SVIX wrote:
> are u sure u were not able to solve this on ur own?
>
> On Jan 6, 3:26 am, dinesh
are u sure u were not able to solve this on ur own?
On Jan 6, 3:26 am, dinesh bansal wrote:
> Hi Guys,
>
> There are some questions asked to me:
>
> 1. How do you print the SLL in reverse order. List should not be changed.
> 2. Two SLLs are merging at one point, how can you find out efficiently.
There is another solution which I think is worth sharing . Traverse
till the end of one linked list then connect this end to starting of
second linked list . Now the Y - shaped Lists are actually P -
shaped . And then it becomes the case of finding a loop and its
position in linked list . Which I t
@Sanchit..sorry i didnt see the replies :P
On Thu, Jan 6, 2011 at 11:32 PM, sanchit mittal wrote:
> Problem hav been solved u all giving same answers..!
>
>
> On Thu, Jan 6, 2011 at 11:30 PM, nishaanth wrote:
>
>> for 2nd question.
>>
>> Let m1,m2 be the length of sll1 and sll2..
>>
>> now
Problem hav been solved u all giving same answers..!
On Thu, Jan 6, 2011 at 11:30 PM, nishaanth 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
>
> sk
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 requi
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 wrote:
> How can two list just intersect, each node can have one pointer to the
> n
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 wrote:
> Is it necessary that the two lists are merging at their ends??
> Do we have to find whether they merge at the
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 wrote:
> There are two aspects here for second question.
> 1. to find if the common nod
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 a
Hii
@ Question 2 -
1. Just count the no of nodes in each link list lets say N1 and N2 are the
number of the nodes in first and second linklist respectively.
2. Now calculate the difference of the Nodes like as
p = {N1~N2)
3. Now take 2 pointers say P1 and P2.
4.
a. If N1 >N2 then put t
@ 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 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
@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 wrote:
> @vishal
> saurabh is right
> its merging at only one point its a Y-shaped struc
@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 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 cy
@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 wr
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.
comple
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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks
On Thu, Jan 6, 2011 at 5:25 PM, juver++ wrote:
> 1. Recursive function. Print node's element after processing next link of
> the current node. Also this can be achieved using stack.
> 2. Please clarify the question.
>
> --
> You received this message because you are subscribed to the Google Group
Hi, I'm new here and looking to learn more on algos and participate in
discussions.
@juver++, Recursion solution to the 1st problem implicitly using
stack. No?
print (list l)
{
if(i->next) print(l->next);
print l;
}
On Jan 6, 4:55 pm, juver++ wrote:
> 1. Recursive function. Print node's
1. Recursive function. Print node's element after processing next link of
the current node. Also this can be achieved using stack.
2. Please clarify the question.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send em
20 matches
Mail list logo