@@ -27,7 +27,7 @@ class Node:
2727 True
2828 """
2929
30- def __init__ (self , key ):
30+ def __init__ (self , key ) -> None :
3131 self .key = key
3232 self .degree = 0
3333 self .marked = False
@@ -69,11 +69,11 @@ class FibonacciHeap:
6969 3
7070 """
7171
72- def __init__ (self ):
72+ def __init__ (self ) -> None :
7373 self .min_node = None
7474 self .total_nodes = 0
7575
76- def insert (self , key ):
76+ def insert (self , key ) -> Node :
7777 """Insert a new key into the heap.
7878
7979 Args:
@@ -105,7 +105,7 @@ def insert(self, key):
105105 self .total_nodes += 1
106106 return new_node
107107
108- def _insert_into_circular_list (self , base_node , node_to_insert ):
108+ def _insert_into_circular_list (self , base_node , node_to_insert ) -> Node :
109109 """Insert node into circular linked list.
110110
111111 Args:
@@ -136,7 +136,7 @@ def _insert_into_circular_list(self, base_node, node_to_insert):
136136 base_node .right = node_to_insert
137137 return base_node
138138
139- def extract_min (self ):
139+ def extract_min (self ) -> Node :
140140 """Remove and return the minimum key from the heap.
141141
142142 This operation removes the node with the minimum key from the heap,
@@ -325,7 +325,7 @@ def _cut(self, child_node, parent_node):
325325 child_node .parent = None
326326 child_node .marked = False
327327
328- def _cascading_cut (self , current_node ):
328+ def _cascading_cut (self , current_node ) -> None :
329329 """Perform cascading cut operation.
330330
331331 Args:
@@ -338,7 +338,7 @@ def _cascading_cut(self, current_node):
338338 self ._cut (current_node , parent_node )
339339 self ._cascading_cut (parent_node )
340340
341- def delete (self , node ):
341+ def delete (self , node ) -> None :
342342 """Delete a node from the heap.
343343
344344 This operation removes a given node from the heap by first decreasing
@@ -365,7 +365,7 @@ def delete(self, node):
365365 self .decrease_key (node , float ("-inf" ))
366366 self .extract_min ()
367367
368- def find_min (self ):
368+ def find_min (self ) -> Any :
369369 """Return the minimum key without removing it from the heap.
370370
371371 This operation provides quick access to the minimum key in the heap
@@ -384,7 +384,7 @@ def find_min(self):
384384 """
385385 return self .min_node .key if self .min_node else None
386386
387- def is_empty (self ):
387+ def is_empty (self ) -> bool :
388388 """Check if heap is empty.
389389
390390 Returns:
@@ -400,7 +400,7 @@ def is_empty(self):
400400 """
401401 return self .min_node is None
402402
403- def merge (self , other_heap ):
403+ def merge (self , other_heap ) -> None :
404404 """Merge another Fibonacci heap into this one.
405405
406406 This operation combines two Fibonacci heaps by concatenating their
0 commit comments