implement isInTree and removeSmallest methods