Two-element tree structure algorithm description