MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / __init__

Method __init__

BinarySearchTree.py:3–8  ·  view source on GitHub ↗
(self, key, val, left = None, right = None, parent = None)

Source from the content-addressed store, hash-verified

1# 构建二叉查找树(非平衡)
2class TreeNode:
3 def __init__(self, key, val, left = None, right = None, parent = None):
4 self.key = key
5 self.payload = val
6 self.leftChild = left
7 self.rightChild = right
8 self.parent= parent
9
10 def hasLeftChild(self):
11 return self.leftChild

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected