Questions on Recursion ● define recursion, recursive function definition ● what is function invocation? how is function invocation related to function definition? What is special about invocation of a recursive function? ● what is program stack? stack frame? what happens with stack if recursive function is invoked multiple times? What is the scope of automatic variables in a recursive function invocation? ● what is stopping case? stack overflow? infinite recursion? ● how is recursion related to iteration?

Why recursion ● in top-down design one of the major techniques is to break the task into subtasks and code the tasks separately ● it may turn out that one of the subtasks is a smaller version of the larger task ● example: to search an array you split it into halves, searching each half is similar to searching the whole

This is the end of the preview. Sign up
to
access the rest of the document.