字符串的replaceAll方法的时间复杂度是多少??

java中字符串的replaceAll方法的时间复杂度是多少??是O(n)吗

这个用的正则 正则效率,建议找本书看看正则的效率,根据你正则的写法效率是不一样的。

不是吧
一次遍历就能解决的,应该是 O(1)

http://stackoverflow.com/questions/4378455/what-is-the-complexity-of-regular-expression

http://stackoverflow.com/questions/10091790/why-doesnt-java-include-the-time-space-complexity-of-each-function-in-the-javad

http://stackoverflow.com/questions/21669/complexity-of-regex-substitution