Choosing parameters in a recursion

I am taking the data structures and algorithms course, and I am currently studying recursion. In the “findWords” method, Mosh used a list as a parameter to store the words identified. However, in the “countWords” method, he didn’t use size as a parameter. By this rule, he doesn’t really need to use a list as a parameter in the “findWords” method, does he?

In my opinion, only the inputs and states (which affect current choices) are required in the parameters, supposing that the fewer parameters the better.

Generally it is helpful to refer to a course, lecture and lesson so we know what we’re talking about. Is your question about the Auto Completion excercise in Data Structures 2, Tries, lessons 13/14?

I can’t really follow your argumentation. What “size” are you talking about and what “rule”?

You can almost always do things differently and better. Post your solution so we can discuss it.

1 Like