implemented min_depth tree algo