On Aug 26, 2006, at 3:17 PM, jbv wrote:

Does anyone have (or know of) an algorithm to find repeating
patterns of characters in a string ?

This brute-force method came to my mind. Decide on a min and max length of patterns. Try all possible substrings. (Outer loop is start position, inner loop is end char based on min & max length. With each one check in an array. If not there put 1 otherwise increment. Look for counts greater than 1.

If the repeating pattern must come right after the starting pattern, then this does not apply. In that case, just look for the repeats of the substring after the trial string. The problem is that "xaxaxaxa" would be counted as a repeating of "xa" and a repeating of "xaxa".

Dar Scott
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to