mercredi 30 novembre 2016

time complexity of regular expression in java

I wrote the following script by using regular expression to find a repeated string in the string s,now i try to find the complexity of it, if any one know what is the complexity of it, please let me know.

String s = "ABCABCAAAABBBBCCAAABCGABCABC";
           Pattern pattern = Pattern.compile("(?:([ABC])(?!\\1)([ABC])\\1\\2)+");
           Matcher matcher = pattern.matcher(s);
           while (matcher.find()) {
            System.out.print("FOUND");

            }

Aucun commentaire:

Enregistrer un commentaire