Exemplo n.º 1
0
 public void insert(Integer x) {
   if (max.isEmpty()) {
     max.insert(x);
   } else if (lessOrEqual(x, max.max())) {
     max.insert(x);
   } else {
     min.insert(x);
   }
   balance();
 }