Implemented optimization based on tree size and path compression.