I think it depends on the language you are using. And also how easy it is to test that the pointer is to self. Null is usually easy to check.
But also as Janne said: use a ready library and do like it does.
NP: For a node the link should be called parent not root. There is only one root in a tree.
I think it depends on the language you are using. And also how easy it is to test that the pointer is to self. Null is usually easy to check.
But also as Janne said: use a ready library and do like it does.
NP: For a node the link should be called parent not root. There is only one root in a tree.