You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
class Node
|
|
attr_accessor :left, :right, :data
|
|
|
|
def initialize(data)
|
|
self.data = data
|
|
end
|
|
|
|
def to_s
|
|
"(Data: #{@data}) : (Left: #{@left&.data}) : (Right: #{@right&.data})"
|
|
end
|
|
|
|
def ==(other)
|
|
data == other.data
|
|
end
|
|
end
|