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

Method _put

BinarySearchTree.py:65–75  ·  view source on GitHub ↗
(self, key, val, currentNode)

Source from the content-addressed store, hash-verified

63 self.size = self.size + 1
64
65 def _put(self, key, val, currentNode):
66 if key < currentNode.key:
67 if currentNode.hasLeftChild():
68 self._put(key, val, currentNode.leftChild)
69 else:
70 currentNode.leftChild = TreeNode(key, val, parent=currentNode)
71 else:
72 if currentNode.hasRightChild():
73 self._put(key, val, currentNode.rightChild)
74 else:
75 currentNode.rightChild = TreeNode(key, val, parent=currentNode)
76
77 def __setitem__(self, k, v):
78 self.put(k, v)

Callers 1

putMethod · 0.95

Calls 3

TreeNodeClass · 0.70
hasLeftChildMethod · 0.45
hasRightChildMethod · 0.45

Tested by

no test coverage detected