implementation of various tree