MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __eq__

Method __eq__

data_structures/binary_tree/red_black_tree.py:502–509  ·  view source on GitHub ↗

Test if two trees are equal.

(self, other: object)

Source from the content-addressed store, hash-verified

500 )
501
502 def __eq__(self, other: object) -> bool:
503 """Test if two trees are equal."""
504 if not isinstance(other, RedBlackTree):
505 return NotImplemented
506 if self.label == other.label:
507 return self.left == other.left and self.right == other.right
508 else:
509 return False
510
511
512def color(node: RedBlackTree | None) -> int:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected