How would I set the default parent node to root in this binary tree in Python?
I have the following, but its giving the error below.
class Tree:
def __init__(self):
self.root=None
def insertNode(self,parentNode=self.root,node=None):
if self.root is None:
self.root=node
This is the error its giving:
def insertNode(self,parentNode=self.root,node=None):
NameError: name 'self' is not defined
Thanks in advance