Having serous trouble with this coding. Similar to findNode, but rather than returning the node that contains the target, instea | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Having serous trouble with this coding. Similar to findNode, but rather than returning the node that contains the target, instea

Having serous trouble with this coding. Similar to findNode, but rather than returning the node that contains the target, instead returns a list of nodes above the one that contains the target, in low to high level order. * @param node the current node being examined * @param target the Person being searched for * @return an ArrayList of nodes that are directly above the * target in the hierarchy private ArrayList<MultiTreeNode<Person>> findNodeChain(MultiTreeNode<Person> node, Person target) { throw new UnsupportedOperationException("Not supported yet."); } --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- What I have tried so far: private ArrayList<MultiTreeNode<Person>> findNodeChain(MultiTreeNode<Person> node, Person target) { return findNodeChain(node, target, new ArrayList<>()); }

30th Apr 2020, 6:50 PM
Benjamin
1 Answer
0
create new array while hasnext node = nextnode if node contains target add to list return list
30th Apr 2020, 9:29 PM
zemiak