Thursday, March 10, 2016

Lecture 7

Our lecture had begun with more on recursive functions. He explained about recursive function, max_list with the function that we saw in last week. Last week, we only discussed what recursive function of list. Now, we learn recursive functions that do not use a list as a parameter.  Fibonacci function and Factorial function are new examples of recursive functions. We practiced how the functions works. For example, Fibonacci(5) = 8 with steps of what Fibonacci of less than 5 would be. Then, we viewed another example, Balanced Strings. He explained about its base case and recursive cases with situations when they would achieve condition. Next, he showed how to trace function of Stack of activation records, which shows which line number and function are used, and what happens on a parameter of the function.
Moreover, he explained why recursive function is important. No recursive function is more efficient than its iterative equivalent for problems that are naturally recursive.
Class tree is discussed. There are several functions, called height, paths, leaves, count, and others in the tree. These functions can be written by recursive.

Writing recursive function is new and tracing the recursive functions with Stack step is difficult. 

No comments:

Post a Comment