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

Method get_max

data_structures/binary_tree/red_black_tree.py:402–410  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

400 return self.label
401
402 def get_max(self) -> int | None:
403 """Returns the largest element in this tree.
404 This method is guaranteed to run in O(log(n)) time.
405 """
406 if self.right:
407 # Go as far right as possible
408 return self.right.get_max()
409 else:
410 return self.label
411
412 def get_min(self) -> int | None:
413 """Returns the smallest element in this tree.

Callers 2

test_min_maxFunction · 0.95
removeMethod · 0.45

Calls

no outgoing calls

Tested by 1

test_min_maxFunction · 0.76