page404.html

来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 46 行

HTML
46
字号
<HTML><HEAD><TITLE>Representing Partitions</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html5835" HREF="page405.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5833" HREF="page403.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5829" HREF="page403.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html5837" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0012401000000000000000">Representing Partitions</A></H3><P>Program&nbsp;<A HREF="page404.html#progpartitiona"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> defines the <tt>Partition</tt> class.The abstract <tt>Partition</tt> class extendsthe abstract <tt>Set</tt> classdefined in Program&nbsp;<A HREF="page388.html#progseta"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.Since a partition is a set of sets,it makes sense to derive <tt>Partition</tt> from <tt>Set</tt>.The two methods, <tt>find</tt> and <tt>join</tt>,correspond to the partition operations described above.<P><P><A NAME="28257">&#160;</A><A NAME="progpartitiona">&#160;</A> <IMG WIDTH=575 HEIGHT=240 ALIGN=BOTTOM ALT="program28158" SRC="img1623.gif"  ><BR><STRONG>Program:</STRONG> Abstract <tt>Partition</tt> class.<BR><P><P>The elements of a partition are also sets.Consequently, the objects contained in a <tt>Partition</tt>are also derived from the <tt>Set</tt> class.The <tt>find</tt> method of the <tt>Partition</tt> classexpects as its argument an <tt>int</tt>and returns the set which contains the specified item.<P>The <tt>join</tt> method takes two arguments,both of them references to sets.The two arguments are expected to be distinct elements of the partition.The effect of the <tt>join</tt> operation is to remove the specified setsfrom the partition and replace them with a set which representsthe <em>union</em> of the two.<P><HR><A NAME="tex2html5835" HREF="page405.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5833" HREF="page403.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5829" HREF="page403.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html5837" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright &#169; 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a>  All rights reserved.</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?