estion 2: (5 marks)
this question you should complete some methods in BSTree.java file.
The class Dog (with 3 data members: place, weight and color) is given and you do not need to edit it. The BSTree class is a binary search tree of Dog objects. The variable weight is the key of the BSTree. In this test, these values (weight) must be unique. The following methods should be completed:
void insert(String xPlace, int xWeight, int xColor)
void f1() Your task is to add statements in the insert(...) method so that any node with xPlace.charAt(0) == 'F' is not inserted to the tree. The expected output in file f1.txt should be as follows (line 1: Breadth first traversal, line 2: In-order traversal)(Χ,5,2) (Ν,3,6) (M,9,5) (P,1,3) (R,4,8) (Q,8,7) (L,7,6)
(P,1,3) (N,3,6) (R,4,8) (X,5,2) (L,7,6) (Q,8,7) (M,9,5)
void f211- Perform pre-order traversal for the of the BST hut display to file f2 txt nodes with
Zoom
100%
Close