19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER<br />

20<br />

RECURSION<br />

Objectives<br />

■<br />

■<br />

■<br />

To describe what a recursive method is and the benefits of using recursion<br />

(§20.1).<br />

To develop recursive methods for recursive mathematical functions<br />

(§§20.2–20.3).<br />

To explain how recursive method calls are handled in a call stack<br />

(§§20.2–20.3).<br />

■ To solve problems using recursion (§20.4).<br />

■ To use an overloaded helper method <strong>to</strong> design a recursive method (§20.5).<br />

■ To implement a selection sort using recursion (§20.5.1).<br />

■ To implement a binary search using recursion (§20.5.2).<br />

■ To get the direc<strong>to</strong>ry size using recursion (§20.6).<br />

■ To solve the Towers of Hanoi problem using recursion (§20.7).<br />

■ To draw fractals using recursion (§20.8).<br />

■<br />

To discover the relationship and difference between recursion and<br />

iteration (§20.9).<br />

■ To know tail-recursive methods and why they are desirable (§20.10).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!