two hierarchies intersection algorithms implemented