Browse files

Use 2 values comparison instead of Array.new#max

Perf!
  • Loading branch information...
1 parent 2af470a commit 873e4b70d4c23fd56596c0801fb2764f14b12898 @nahi committed Jan 13, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/avl_tree.rb
View
2 lib/avl_tree.rb
@@ -164,7 +164,7 @@ def dump_sexp
end
def height
- @height ||= [@left.height, @right.height].max + 1
+ @height ||= (@left.height > @right.height ? @left.height : @right.height) + 1
end
protected

0 comments on commit 873e4b7

Please sign in to comment.