You cannot do this inplace:
for( j = i+1; j < M; ++j ) idx[ i ] += N - idx[ M - j + i ];
as you are overwriting values that are still needed. This corresponds to the "reversing" the string part of the regex. In addition, you misread the formula, there is no += involved.
In reply to Re^9: Odometer pattern iterator (in C).
by hdb
in thread Odometer pattern iterator (in C). (Updated.)
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |