At most, a handle and a pattern can be defined for every node of the tree. For each node a sub-tree, which at most equals the whole DOM-tree, must be revisited; therefore, N is multiplied by N in the formula.
I try to explain the reasons for a formula, I describe the worst case. In the sentence above by "At most" I want to say "the most number of the patterns equals the whole number of nodes of a tree". Did I used "At most" correctly in the right position?