1,899 views
2 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 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 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 n  number of children, without disrupting the hierarchy.

Option B

Answer:
Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
1.6k
1.6k views
Arjun asked Oct 10, 2016
1,624 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 ...
1 1 vote
2 2 answers
1.8k
1.8k views
Arjun asked Oct 10, 2016
1,837 views
Which of the following is false?Arrays are better than linked lists for sorting due to better data locality.Asymptotic time complxity for FindMax is same on an unsorted a...
0 0 votes
3 answers 3 answers
1.5k
1.5k views
Arjun asked Oct 10, 2016
1,488 views
Consider a complete graph of 10 vertices. The minimum no. of edge removals required to make the graph disconnected is ______
5 5 votes
1 answers 1 answer
2.2k
2.2k views
Arjun asked Oct 10, 2016
2,236 views
Consider a stack with 100 elements present. Suppose in a scenario, we are required to remove the first inserted element in it, which is done by POP operations followed by...