Permalink
Browse files

Extract leaf? method.

  • Loading branch information...
1 parent 10acc26 commit 8ce6a04e0ae2b77c277b234535f726cef4eebb4e @xaviershay committed Feb 26, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 binary_tree.rb
View
@@ -102,6 +102,10 @@ def minimum
left.minimum
end
end
+
+ def leaf?
+ left.empty? && right.empty?
+ end
end
def initialize

0 comments on commit 8ce6a04

Please sign in to comment.