hamidgasmi/training.computerscience.algorithms-datastructures

Find whether individual x is a friend of individual y

hamidgasmi opened this issue · 0 comments

This problem is available here

Consider a situation with a number of persons and following tasks to be performed on them.

  • Add a new friendship relation, i.e., a person x becomes friend of another person y.
  • Find whether individual x is a friend of individual y (direct or indirect friend)

E.g.
We are given 10 individuals: a, b, c, d, e, f, g, h, i, j

Following are relationships to be added
a <-> b
b <-> d
c <-> f
c <-> i
j <-> e
g <-> j

And given queries like whether a is a friend of d or not.