698 views
2 votes
2 votes

What would be an appropraite data structure to represent family hierarchy where each node is an individual and there in no requirement to keep "married to" relationship?

  1. Binary Tree
  2. n-ary Tree
  3. Graph
  4. Linked List

2 Answers

3 votes
3 votes
with binary tree is not possible . cause we cannot represent one hving more than two children.

with n tree not possible . we can not represent sibiling or other kind of relationship that creates cycle.

yes, with graph , it is possible. and it is aprropriate.

with cyclic doubly linked list , it is possible to implement but it takes lot of space for double pointers . it is not appropriate than graph .

so i will go with option c
edited by
0 votes
0 votes

It is definitely n-ary tree.

Linked List can't represent someone having two children.

Binary tree can't represent someone having three children.

A graph can represent A's child to be the father of B if A and B are siblings. (Visualize it)

An n-ary tree would represent someone having  number of children, without disrupting the hierarchy.

Option B

Answer:

Related questions

4 votes
4 votes
1 answer
1
Arjun asked Oct 10, 2016
727 views
In a Network where bytes are continuously being transferred, it is required to identify the most frequently transferred byte. What would be an appropriate data structure ...
0 votes
0 votes
3 answers
3
Arjun asked Oct 10, 2016
614 views
Consider a complete graph of 10 vertices. The minimum no. of edge removals required to make the graph disconnected is ______