Lecture 19 Part 3: More Visitors
October 5, 2012Ambient temperature: 74.5oF Concepts There are three approaches to the “sum” algorithm on the NEList/MTList list structure: nonEmptyCase(…) { return MY_VALUE + rest_of_list.execute( this ); } This is TAIL recursion, and accumulates the return value on the STACK. Another name for it is “Forward Accumulation.” nonEmptyCase(…) { return rest_of_list.execute( this ) + MY_VALUE; } This […]