23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

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

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

• In class Union Merge, merge copies every element from A <strong>and</strong> B <strong>in</strong>to<br />

C, but does not duplicate any element.<br />

• In class IntersectMerge, merge copies every element that is <strong>in</strong> both<br />

A <strong>and</strong> B <strong>in</strong>to C, but "throws away" elements <strong>in</strong> one set but not <strong>in</strong> the other.<br />

• In class SubtractMerge, merge copies every element that is <strong>in</strong> A <strong>and</strong><br />

not <strong>in</strong> B <strong>in</strong>to C.<br />

Code Fragment 11.10: Classes extend<strong>in</strong>g the Merge<br />

class by specializ<strong>in</strong>g the auxiliary methods to perform<br />

set union, <strong>in</strong>tersection, <strong>and</strong> subtraction, respectively.<br />

719

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

Saved successfully!

Ooh no, something went wrong!