Returns the largest element in this tree. This method is guaranteed to run in O(log(n)) time.
(self)
| 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. |
no outgoing calls