MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / get_min

Method get_min

data_structures/binary_tree/red_black_tree.py:412–420  ·  view source on GitHub ↗

Returns the smallest element in this tree. This method is guaranteed to run in O(log(n)) time.

(self)

Source from the content-addressed store, hash-verified

410 return self.label
411
412 def get_min(self) -> int | None:
413 """Returns the smallest element in this tree.
414 This method is guaranteed to run in O(log(n)) time.
415 """
416 if self.left:
417 # Go as far left as possible
418 return self.left.get_min()
419 else:
420 return self.label
421
422 @property
423 def grandparent(self) -> RedBlackTree | None:

Callers 1

test_min_maxFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_min_maxFunction · 0.76