@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 saivivekh.swaminat...@gmail.comwrote:
are u sure u were not able to solve this on ur
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++ avpostni...@gmail.com wrote:
1. Recursive
On Thu, Jan 6, 2011 at 5:25 PM, juver++ avpostni...@gmail.com 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
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
@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
@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 aditya...@gmail.com wrote:
@vishal
saurabh is right
its merging at only one point its
@ 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 vishal.ge...@gmail.com wrote:
@aditya,
Who said it's a Y shaped structure, It can very well has a cycle.
Assume the case when
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
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
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 adit.sh...@gmail.com wrote:
There are two aspects here for second question.
1. to
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 tushicom...@gmail.comwrote:
Is it necessary that the two lists are merging at their ends??
Do we have to find
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 naveenkumarve...@gmail.comwrote:
How can two list just intersect, each node can
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
Problem hav been solved u all giving same answers..!
On Thu, Jan 6, 2011 at 11:30 PM, nishaanth nishaant...@gmail.com 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=
@Sanchit..sorry i didnt see the replies :P
On Thu, Jan 6, 2011 at 11:32 PM, sanchit mittal sm14it...@gmail.com wrote:
Problem hav been solved u all giving same answers..!
On Thu, Jan 6, 2011 at 11:30 PM, nishaanth nishaant...@gmail.com wrote:
for 2nd question.
Let m1,m2 be the length
15 matches
Mail list logo