On Wednesday, we took a test, which covered the linked list, recursion and the algorithm. Having practiced lots of recursive functions, I summarize a strategy to write a correct recursive function. The first step is to check the special condition, such as None type or inappropriate type. The second step is to consider the most basic case. Finally, for those recursive parts, apply the function to each item.
No comments:
Post a Comment