Answer to Question #312164 in C++ for cobet

Question #312164

Describe a tree structure that can be used to store the genealogical history of a family. What operations are performed on the tree? If the tree is implemented as a linked structure, what pointers should be associated with each node? Design procedures to perform the operations you identified above, assuming that the tree is implemented as a linked structure with the pointers you just described. Using your storage system, explain how one could find all the siblings of a person.

1
Expert's answer
2022-03-15T12:59:57-0400

A tree is a data structure that is a tree structure in the form of a set of connected nodes.


A binary tree is a finite set of elements that is either empty or contains an element (root) associated with two different binary trees, called left and right subtrees. Each element of a binary tree is called a node. The links between the nodes of a tree are called its branches.

The root of the tree is located at the level with the minimum value.


A node D that is directly below node B is called a child of B. If D is at level i, then B is at level i-1. Node B is called an ancestor of D.


The maximum level of any element of the tree is called its depth or height.


If an element has no children, it is called a leaf or leaf node of the tree.


The remaining elements are internal nodes (branch nodes).


The number of children of an internal node is called its degree. The maximum degree of all nodes is the degree of the tree.


The number of branches to go from the root to node x is called the length of the path to x. The root has a path length of 0; a node at level i has a path length equal to i.


A binary tree is used in cases where at each point in the computational process one of two possible decisions must be made.


There are many tasks that can be performed on the tree.


A common task is to perform a given operation p on each element of the tree. Here p is considered as a parameter of a more general problem of visiting all nodes or tree traversal problem.


If we consider the task as a single sequential process, then individual nodes are visited in a certain order and can be considered linearly located.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment