Tree NewTreeInsert(Tree t, Item it) { t = TreeInsert(t,it); // e.g. after every 20 insertions if (size(t) % 20 == 0) t = rebalance(t); return t; }