mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Added __eq__ method to ensure invert_tree_challenge tests pass.
This commit is contained in:
parent
d60f4a904c
commit
f16c42aa12
|
@ -7,7 +7,10 @@ class Node(object):
|
|||
self.parent = None
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.data)
|
||||
return 'Node<data=%s>' % (self.data,)
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, Node) and self.data == other.data
|
||||
|
||||
|
||||
class Bst(object):
|
||||
|
@ -40,4 +43,4 @@ class Bst(object):
|
|||
node.right.parent = node
|
||||
return node.right
|
||||
else:
|
||||
return self._insert(node.right, data)
|
||||
return self._insert(node.right, data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user