I have written this code that does the job i want it to. What I want to do is figure out the big O notation for the code. So I want to learn how to calculate the time complexity and end up with a big O notation result. How is it done in lay mans terms?
"""
def treetocode(hTree):
code = dict()
def getCode(hNode, currentcode=""):
if (hNode == None): return
if (hNode.left == None and hNode.right == None):
code[hNode.char] = currentcode
getCode(hNode.left, currentcode + "0")
getCode(hNode.right, currentcode + "1")
if hNode.char == None:
return None
else:
print('Character = {} : Freq = {} --- Huffman code {}'.format(hNode.char, hNode.freq, currentcode))
getCode(hTree)
return code
"""