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

Function get_child_left_position

graphs/minimum_spanning_tree_prims2.py:30–37  ·  view source on GitHub ↗

heap helper function get the position of the left child of the current node >>> get_child_left_position(0) 1

(position: int)

Source from the content-addressed store, hash-verified

28
29
30def get_child_left_position(position: int) -> int:
31 """
32 heap helper function get the position of the left child of the current node
33
34 >>> get_child_left_position(0)
35 1
36 """
37 return (2 * position) + 1
38
39
40def get_child_right_position(position: int) -> int:

Callers 1

_bubble_downMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected