mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-21 08:42:03 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
672cb3bbd9
commit
c91f6b6359
|
@ -195,7 +195,6 @@ def get_left_most(root: MyNode) -> Any:
|
||||||
return root.get_data()
|
return root.get_data()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def del_node(root: MyNode, data: Any) -> MyNode | None:
|
def del_node(root: MyNode, data: Any) -> MyNode | None:
|
||||||
if root is None:
|
if root is None:
|
||||||
print("Node is empty, nothing to delete")
|
print("Node is empty, nothing to delete")
|
||||||
|
@ -229,7 +228,9 @@ def del_node(root: MyNode, data: Any) -> MyNode | None:
|
||||||
root.set_right(del_node(right_child, data))
|
root.set_right(del_node(right_child, data))
|
||||||
|
|
||||||
# Update the height of the node
|
# Update the height of the node
|
||||||
root.set_height(1 + my_max(get_height(root.get_left()), get_height(root.get_right())))
|
root.set_height(
|
||||||
|
1 + my_max(get_height(root.get_left()), get_height(root.get_right()))
|
||||||
|
)
|
||||||
|
|
||||||
# Get the balance factor
|
# Get the balance factor
|
||||||
balance_factor = get_height(root.get_right()) - get_height(root.get_left())
|
balance_factor = get_height(root.get_right()) - get_height(root.get_left())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user