On 14/12/2007, Eric I. <rubytraining / gmail.com> wrote: > avl_tree.rb > __BEGIN__ > #!/usr/bin/env ruby -wKU > class AVLTree > def initialize > @contents = [] > end > > def empty? > @contents.empty? > end > > def include?(obj) > @contents.include?(obj) > end > > def <<(obj) > @contents << obj > end > > def height > (Math.log(@contents.size + 1) / Math.log(2)).round > end > Now I think this one is misleading. Here you choose to lie about the tree height. There is no way one can detect this by a test, a list passes for a binary tree at any time. It is just somewhat unbalanced - the real height is @contents.length > def to_a > end > end > __END__ Thanks Michal