Re: [algogeeks] Lets Discuss About Some More Practical Application of Data Structure Algorithm , Problem Solving - How You WIll The Mutual Friends Between each m*n friends

2012-01-25 Thread Aayush saxena
This might not lead to a correct solution always. Say, if B and C were not friends, you would get two paths which are of same length. But both B and C are still mutual friends of A and D. Besides, I am not sure if taking A-B-C-D as a path would make a good representation. @Shashank: If you are

Re: [algogeeks] Re: longest palindrome

2012-01-25 Thread Aayush saxena
Regarding the explanation of the suffix tree method, here is the link: http://algo2006.csie.dyu.edu.tw/paper/2/A24.pdf On Tue, Jan 24, 2012 at 8:05 PM, Ashish Goel ashg...@gmail.com wrote: http://www.akalin.cx/longest-palindrome-linear-time lovely explanation.. Best Regards Ashish Goel

Re: [algogeeks] Lets Discuss About Some More Practical Application of Data Structure Algorithm , Problem Solving - How You WIll The Mutual Friends Between each m*n friends

2012-01-19 Thread Aayush saxena
Then I will go with Atul's solution. BFS should work. Consider the graph with nodes representing as people and edges to be the friendship association. For any i,j pair you need to look for the paths of length 2 from one node to another. For finding it out for all the pairs, it will have to be done

Re: [algogeeks] Lets Discuss About Some More Practical Application of Data Structure Algorithm , Problem Solving - How You WIll The Mutual Friends Between each m*n friends

2012-01-18 Thread Aayush saxena
I am still not clear on the question! Do it suggest that we have m people with n friends each and the problem is to find mutual friends b/w any two people? And by the mutual friend, does it mean that he has to be a friend of both of the people or can he be indirectly linked? Your previous comment