In a binary search Tree
Posted
by
user1044800
on Stack Overflow
See other posts from Stack Overflow
or by user1044800
Published on 2011-11-14T01:47:57Z
Indexed on
2011/11/14
1:50 UTC
Read the original article
Hit count: 232
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.....
© Stack Overflow or respective owner