Added tests and docstrings to fibonacci_heap.py

This commit is contained in:
mcawezome 2024-11-18 12:26:21 +08:00
parent a1291fd5ca
commit c4516d1dfc

View File

@ -271,11 +271,11 @@ class FibonacciHeap:
def decrease_key(self, node, new_val): def decrease_key(self, node, new_val):
""" """
Decreases the value of a node. Decreases the value of a node.
Args: Args:
node: The node whose value should be decreased. node: The node whose value should be decreased.
new_val: The new value for the node. new_val: The new value for the node.
Raises: Raises:
ValueError: If new value is greater than current value. ValueError: If new value is greater than current value.
""" """
@ -299,11 +299,6 @@ class FibonacciHeap:
Args: Args:
node: Node to be cut. node: Node to be cut.
parent: Parent of the node to be cut. parent: Parent of the node to be cut.
""""""
Performs cascading cut operation.
Args:
node: Starting node for cascading cut.
""" """
parent.degree -= 1 parent.degree -= 1