, one line for all people in the tree).Your task is to be able to find the descendants of any person in a family tree, e.g. thedescendants of p1 are p4.p5,p7,p8 in O(|P|) time, where P is the set of...


2. You have a family tree diagram like the following, very smallI, sample tree and file. It is stored as<br>a file with the following format (parent: <list of children>, one line for all people in the tree).<br>Your task is to be able to find the descendants of any person in a family tree, e.g. the<br>descendants of p1 are p4.p5,p7,p8 in O(|P|) time, where P is the set of people in the graph.<br>. p0: p4, p5 p1: p4, p5 p2: p6 p3: p6 p4: p4 p5: p7, p8 p6: p7, p8 p7: p8: p7 p8 Preprocess File By: How to retrieve descendants (O(|P|) time, max): getDescendants(Person <,possibly some="" other="" data="" structure="">): "/>
Extracted text: 2. You have a family tree diagram like the following, very smallI, sample tree and file. It is stored as a file with the following format (parent: , one line for all people in the tree). Your task is to be able to find the descendants of any person in a family tree, e.g. the descendants of p1 are p4.p5,p7,p8 in O(|P|) time, where P is the set of people in the graph. "Sketching" the approach is fine but you may give full pseudocode, just reuse an algorithm from class, perform some obvious conversion (Adjacency Matrix to/from Array List, etc.) or some combination of these. You may not use depth first search or breadth first search. You may preprocess the input with any polynomial approach and may assume the |P| people in the tree are labelled po, p1, .p. p0: p4, p5 p1: p4, p5 p2: p6 p3: p6 p4: p4 p5: p7, p8 p6: p7, p8 p7: p8: p7 p8 Preprocess File By: How to retrieve descendants (O(|P|) time, max): getDescendants(Person <,possibly some="" other="" data="" structure="">):
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here