Lecture 10 Notes

Usage 4 the basic testing procedure provided

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: presents the information that was in the original list but would now be invisible to us because we are looking at the sublist. In this case, the only information we need is the number of elements that are above the current sublist. This need not decrease at a recursive call; indeed it grows, because we are passing over another element of the original list. We sometimes call this a context argument or inherited attribute.   4 D!§ ¥ !¤¢ ¢¦¡ 5¤¤© § ¤"£¦ " § 4¡ ¡"¡4 19 1.9 Tail Recursion How could we talk about recursion without doing factorial? ¡§   6§   £  £ §   ¨¥  § ¥ fact usage: produces:   §    £     £  § ¡ 7 8  ¤" £¥  § 9¤¡   6§ 5!  4    £ ©¨¥ ¤  ¡§ £¡ We can model a calculation with :             DC%  £      £      £   A 9E  ¡ ¡ ¡ ¡ ¡ ¡   £   ¡   A "  A "  A "  A "  A "  A "  £   ¡    ¢£  ¡ ¡ ¡ ¡ ¡ ! ¡ ¡ ¡ ¡ ! ¡ ¡ ! ¡ ¡ ¡ ¡ ¡ ! ¡ ! ¡ ¡  ¡ ¡ ¡ !  ! ! ! This is the natural recursi...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online