MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / _right

Method _right

data_structures/heap/heap_generic.py:30–33  ·  view source on GitHub ↗

Returns right-child-index of given index if exists else None

(self, i: int)

Source from the content-addressed store, hash-verified

28 return left if 0 < left < self.size else None
29
30 def _right(self, i: int) -> int | None:
31 """Returns right-child-index of given index if exists else None"""
32 right = int(2 * i + 2)
33 return right if 0 < right < self.size else None
34
35 def _swap(self, i: int, j: int) -> None:
36 """Performs changes required for swapping two elements in the heap"""

Callers 1

_get_valid_parentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected