In a binary search Tree
- by user1044800
In a binary search tree that takes a simple object.....when creating the getter and setter methods for the left, right, and parent. do I a do a null pointer? as in this=this or do I create the object in each method? Code bellow...
This is my code:
public void setParent(Person parent) {
parent = new Person( parent.getName(), parent.getWeight());
//or is the parent supposed to be a null pointer ????
This is the code it came from:
public void setParent(Node parent) {
this.parent = parent;
}
Their code takes a node from the node class...my set parent is taking a person object from my person class.....