Skip to content

Commit

Permalink
Extract leaf? method.
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Feb 26, 2012
1 parent 10acc26 commit 8ce6a04
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binary_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def minimum
left.minimum
end
end

def leaf?
left.empty? && right.empty?
end
end

def initialize
Expand Down

0 comments on commit 8ce6a04

Please sign in to comment.