twerk 0 Newbie Poster

Hey,

Im implementing a binary tree in a project of mine and I'm currently writing a remove method.

lets say my tree is this

5
/
4

and lets say I want to remove 4. My nodes attriubtes are the key, left and right children. Initially, the left and right children are null. So 4 has null left and right children and the right child of 5 is null. I check if 4's left and right child are null, then set 5's left child to 4's right child. ie to be null. So theoretically 5's left child is null. However if I print leftchild is literally prints "null" opposed to being true null.

Hopefully I explained this correctly.
If write:
if left child of 4 != null
print "not null"

result will be nothing printed

after I remove 4 and write:
if left child of 5 != null
print "not null"

not null be printed even though i set the right child of 4 to 5.
Im not sure where "null" is coming from?!

Thanks