1

I wrote:

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?

1 Answer 1

3

Your usage of

at most

is understandable. However,

At most, a handle and a pattern can be defined for every node of the tree.

is usually expressed

Every node of the tree can have at most one handle and one pattern.

When explaining your formula you may want to use "worst case"

The sub-tree of each node must be revisited, which in worst cases will be the entire DOM-tree, giving a worst case scenario of O(N2) in the formula.

since you are trying to describe the time complexity.

5
  • Every node of the tree can have at most one handle and one pattern, but this is not my intention, as I mentioned in the question, I wan to say the number of handles and patterns at most equals to N (the number of nodes).
    – Ahmad
    Commented Dec 26, 2016 at 7:58
  • But maybe your sentence also convey the same.
    – Ahmad
    Commented Dec 26, 2016 at 7:59
  • "At most, a handle and a pattern can be defined for every node of the tree" means 1 handle and 1 pattern per node. Is "every node can have N handles and N patterns" maybe what you want to say? It means nodes to handles or patterns is one-to-many. A sub-tree is different than a handle or a pattern? Just because a node can have a sub-tree does not mean the node has N handles or N patterns where N is the number of nodes in the sub-tree.
    – Peter
    Commented Dec 26, 2016 at 8:53
  • Yes, in average one handle or pattern is defined for some nodes. At most these nodes can be all the nodes. Matching each pattern may lead to traversing a sub tree.
    – Ahmad
    Commented Dec 26, 2016 at 9:25
  • At most should not be at the head of the sentence if, as you say, it goes with every. Peter's suggestion to use "in the worst case" instead of at most is spot on. Also, you don't want to use can but will have to be or must be. In the worst case, a handle and a pattern will have to be identified for every node in the tree.
    – TimR
    Commented Dec 26, 2016 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .