MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / left_child_idx

Method left_child_idx

data_structures/heap/heap.py:91–99  ·  view source on GitHub ↗

return the left child index if the left child exists. if not, return None.

(self, parent_idx: int)

Source from the content-addressed store, hash-verified

89 return None
90
91 def left_child_idx(self, parent_idx: int) -> int | None:
92 """
93 return the left child index if the left child exists.
94 if not, return None.
95 """
96 left_child_index = 2 * parent_idx + 1
97 if left_child_index < self.heap_size:
98 return left_child_index
99 return None
100
101 def right_child_idx(self, parent_idx: int) -> int | None:
102 """

Callers 1

max_heapifyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected