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

Method right_child_idx

data_structures/heap/heap.py:101–109  ·  view source on GitHub ↗

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

(self, parent_idx: int)

Source from the content-addressed store, hash-verified

99 return None
100
101 def right_child_idx(self, parent_idx: int) -> int | None:
102 """
103 return the right child index if the right child exists.
104 if not, return None.
105 """
106 right_child_index = 2 * parent_idx + 2
107 if right_child_index < self.heap_size:
108 return right_child_index
109 return None
110
111 def max_heapify(self, index: int) -> None:
112 """

Callers 1

max_heapifyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected