passing self data into a recursive function
- by user272689
I'm trying to set a function to do something like this
def __binaryTreeInsert(self, toInsert, currentNode=getRoot(), parentNode=None):
where current node starts as root, and then we change it to a different node in the method and recursivly call it again.
However, i cannot get the 'currentNode=getRoot()' to work. If i try calling the funcion getRoot() (as above) it says im not giving it all the required variables, but if i try to call self.getRoot() it complains that self is an undefined variable. Is there a way i can do this without having to specify the root while calling this method?