Created
May 11, 2018 03:34
-
-
Save Unitoi01/9bf8ab7a82456c343f9517bbec55a377 to your computer and use it in GitHub Desktop.
node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
#1 | |
def __init__(self, val): | |
self.val = val | |
self.leftChild = None | |
self.rightChild = None | |
#2 | |
def get(self): | |
return self.val | |
#3 | |
def set(self, val): | |
self.val = val | |
#4 | |
def getChildren(self): | |
children = [] | |
if(self.leftChild != None): | |
children.append(self.leftChild) | |
if(self.rightChild != None): | |
children.append(self.rightChild) | |
return children |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment