Programming implementation of trees structure