# File test.rb, line 42 def Test::bigtest puts "########### Big test" depth = 1000 arry = (1..depth).to_a shuffle arry tree = RedBlackTree.new t_start = Time.new depth.times{ |i| tree << arry[i] } t_end = Time.new puts "#{depth} inserts took #{t_end-t_start} seconds." # printtree tree puts "Left depth: #{tree.max_depth_of tree.root.left}" puts "Right depth: #{tree.max_depth_of tree.root.right}" t_start = Time.new 1000.times{ search_item = rand(depth) tree.search search_item } t_end = Time.new puts "1000 searches on tree took #{t_end-t_start} seconds" t_start = Time.new 1000.times{ search_item = rand(depth) arry.find{|x| x == search_item} } t_end = Time.new puts "1000 finds on array took #{t_end-t_start} seconds" end