Lecture 10 Notes

# 11 12 4 5 5 4

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

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

Unformatted text preview: to deﬁne a function to ﬁnd powers, eg. e(n x) non-negative integer n. (We deﬁne e(0 x) 1). £ 7 8   § 9¤¡ ¤" £¥    ¥ § 5!  4  ¡ ©¨¥ ¤ ¡§ £¡ £ §   £ © §  ¡  £ ¨¡  Let’s watch this work. We can use good old-fashioned algebraic reasoning.     ¡ ¨¡ ¡    9C ¡ ¡ ¨¡ ¡      D ¡ ¨¡ ¡   D   ¡  ¤         ¡   DA¡ ! ! ! ! ! What’s the moral? If we can reduce the problem to a smaller subproblem, then we can call the procedure itself (“recursively”) to solve the smaller subproblem. Then, as we call the procedure, we ask it to work on smaller and smaller subproblems, so eventually we will ask it about something that it can solve directly (eg n 0, the basis step), and then it will terminate successfully. 11  §  £ ¥   ¤  12   "  4     " ¦¤¢5¤ 5¢" ¥£¡¨ 4¡    ¤   § ¤  ¤"  ¤  "     ¤ "¤  4   9§¨¡ £ ¥ ¨§     £¦...
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