The target of this exercise is to manage binary tree data structures.
We will create a class, called MouseTree,
to represent mouse binary trees, with the same information
used in the laboratory session 9 exercises. Each tree node will represent a mouse,
and will have two links, one for its
father and other for its mother.
Create the class MouseTree following these requisites;
Write a main method to test this class.
- The variables defined in each node will be:
- cdg: string with the mouse code.
- name: string with the mouse name.
- color: string with the mouse color.
- father: reference to the father tree node.
- mother: reference to the mother tree node.
- The class constructor will take two parameters:
- A hashtable containing all the mouse objects.
We can reuse code from the laboratory session 9 exercises.
- the mouse code to select the root node.
- Write a method, called PreOrdenPrint,
to print all the tree nodes in preorden.
- Write a method, called PostOrdenPrint,
to print all the tree nodes in postorden.
- Write a method, called OrdenPrint,
to print all the tree nodes in orden.