简体   繁体   中英

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

since DFS complexity is O(|V|+|E|), here will be O(|V|^2)

So in worst case, the the NFA complexity should be O(N*M^2)?

Am I understanding correct?

Thanks.

在NFA的Algorithms 4th结构中,边的数量最多为3M,因此得到的是O(NM)而不是O(NM ^ 2)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM