MCPcopy
hub / github.com/TheAlgorithms/Python / insert

Method insert

sorts/tree_sort.py:29–39  ·  view source on GitHub ↗
(self, val: int)

Source from the content-addressed store, hash-verified

27 return sum(1 for _ in self)
28
29 def insert(self, val: int) -> None:
30 if val < self.val:
31 if self.left is None:
32 self.left = Node(val)
33 else:
34 self.left.insert(val)
35 elif val > self.val:
36 if self.right is None:
37 self.right = Node(val)
38 else:
39 self.right.insert(val)
40
41
42def tree_sort(arr: list[int]) -> tuple[int, ...]:

Callers 15

tree_sortFunction · 0.95
binary_search_insertionFunction · 0.45
strand_sortFunction · 0.45
insort_leftFunction · 0.45
insort_rightFunction · 0.45
solve_linear_systemFunction · 0.45
simplifyFunction · 0.45
solve_simultaneousFunction · 0.45
graham_scanFunction · 0.45
binary_search_insertMethod · 0.45

Calls 1

NodeClass · 0.70

Tested by

no test coverage detected