Skip to content

Instantly share code, notes, and snippets.

@Unitoi01
Created May 11, 2018 03:34
Show Gist options
  • Save Unitoi01/9bf8ab7a82456c343f9517bbec55a377 to your computer and use it in GitHub Desktop.
Save Unitoi01/9bf8ab7a82456c343f9517bbec55a377 to your computer and use it in GitHub Desktop.
node
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