COMP-550-AlgorithmAnalysis
COMP-550-AlgorithmAnalysis copied to clipboard
Modified Code
you could modify this code by changing
modulos.add((int) (( modulos.get( i ) % m + modulos.get(i + 1) % m ) % m));
to
modulos.add((int) (( modulos.get( i ) + modulos.get(i + 1) ) % m));
it work correctly, since what you add before is the remainder of m, it have to be smaller than m So the step of modulos.get(i) %m is useless and meaningless, since modulos.get(i) always <=m which means modulos.get(i)%m equal to modulos.get(i)