Redefine Tree24Node to add a reference to a nodes parent, as shown below: Add the following two
Question:
Redefine Tree24Node to add a reference to a node’s parent, as shown below:
Add the following two new methods in Tree24:
public Tree24Node<E> getParent(Tree24Node<E> node)
Returns the parent for the specified node.
public ArrayList<Tree24Node<E>> getPath(Tree24Node<E> node)
Returns the path from the specified node to the root in an array list.
Write a test program that adds numbers 1, 2, ..., 100 to the tree and displays the paths for all leaf nodes.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Question Posted: