tree implementation of set