Union set and intersection set with sets as binary trees