Advertisement
Guest User

Untitled

a guest
Nov 17th, 2021
58
13 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use Tree::RB::XS;
  2.  
  3. my $tree = Tree::RB::XS->new( compare_fn => CMP_INT );
  4.  
  5. $tree->put($_ => $_) for 1..2000000;
  6.  
  7. my $test = $tree->min->key;
  8.  
  9. my $test_b = $tree->max->key;
  10.  
  11. printf "Min: %d  Max: %d\n", $test, $test_b;
  12.  
  13. ######## ruby code below ########
  14.  
  15. require "rbtree"
  16.  
  17. rbtree = RBTree.new
  18.  
  19.  
  20. for i in 1..2000000
  21.    rbtree[i] = i
  22. end
  23.  
  24. #rbtree[0] = 0
  25.  
  26. puts "Min:" + rbtree.first.to_s + "Max" + rbtree.last.to_s
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement