Open hzesen1221 opened 12 years ago
Idea: when evaluating the cycle length of a particular number, push each results into a stack, the size of the stack (n) will then become the cycle length.
then, pop each number out, which has cycle length from 1 all the way to n.
analysis: this approach needs twice as many steps as the simplest version, and it does not work well in the recursive approach, therefore, abandoned.
Idea: when evaluating the cycle length of a particular number, push each results into a stack, the size of the stack (n) will then become the cycle length.
then, pop each number out, which has cycle length from 1 all the way to n.