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 worried about the complexity of BFS for this
algorithm, you can optimize it by using additional data structure like Hash
table. Say if you are interested in finding the mutual friends b/w A and D.
Push all the adjacent nodes(people/friends) of A in a hash table. Now,
start doing the same for D on the table. All the collisions would give you
mutual friends b/w them.

On Wed, Jan 25, 2012 at 4:06 PM, WgpShashank <[email protected]>wrote:

> @Mani  Good Analysis .. SO in that case if there more then one path exist
> we wants to to find path of maximum length , because we wants to show
> maximum friends which are mutual between A & D , isn't it makes clear . so
> till we have only discussed about the designing part & some approaches
> ,,not the complexity also do you think Facebook uses these to solve the
> same problem ?
>
>
> Thanks
> Shashank Mani Narayan
> Computer Science
> Birla Institute of Technology Mesra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/RR2UBVsCbRAJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to