[英]NFA complexity of worst case is O(N*M) or O(N*M^2)?
N is the length of string
M is the length of Regular expression.
In the worst case, a digraph G(V,E) may have |V|^2 edges 在最坏的情况下,有向图G(V,E)可能具有| V | ^ 2个边
since DFS complexity is O(|V|+|E|), here will be O(|V|^2) 由于DFS复杂度为O(| V | + | E |),因此这里为O(| V | ^ 2)
So in worst case, the the NFA complexity should be O(N*M^2)? 因此,在最坏的情况下,NFA复杂度应为O(N * M ^ 2)吗?
Am I understanding correct? 我理解正确吗?
Thanks. 谢谢。
在NFA的Algorithms 4th结构中,边的数量最多为3M,因此得到的是O(NM)而不是O(NM ^ 2)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.