page386.html

来自「wqeqwvrw rkjqhwrjwq jkhrjqwhrwq jkhrwq」· HTML 代码 · 共 84 行

HTML
84
字号
<HTML>
<HEAD>
<TITLE>Projects</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
 <img src="cover75.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cover75.gif" alt="Logo" align=right>
<b>Data Structures and Algorithms 
with Object-Oriented Design Patterns in C++</b><br>
<A NAME="tex2html6693" HREF="page387.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page387.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html6691" HREF="page352.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page352.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html6687" HREF="page385.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page385.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html6695" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html6696" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <BR><HR>
<H1><A NAME="SECTION0012700000000000000000">Projects</A></H1>
<P>
<OL><LI>
	Design and implement a sorting algorithm
	using one of the priority queue implementations
	described in this chapter.<LI>
	Complete the <tt>BinaryHeap</tt> class
	declared in Program&nbsp;<A HREF="page357.html#progbinheap1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page357.html#progbinheap1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>
	by providing suitable definitions for the following member functions:
	<tt>CompareTo</tt>, <tt>IsFull</tt>,
	<tt>Accept</tt> and <tt>NewIterator</tt>.
	Write a test program and test your implementation.<LI>
	Complete the <tt>LeftistHeap</tt> class
	declared in Program&nbsp;<A HREF="page364.html#progleftist1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page364.html#progleftist1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>
	by providing suitable definitions for the following member functions:
	<tt>LeftistHeap</tt> (two constructors),
	<tt>Left</tt>, <tt>Right</tt> and <tt>SwapContents</tt>.
	You must also have a complete implementation of the base class
	<tt>BinaryTree</tt>.
	(See Project&nbsp;<A HREF="page298.html#projecttreesbintree" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page298.html#projecttreesbintree"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).
	Write a test program and test your implementation.<LI> <A NAME="projectpqueuesbinomtree">&#160;</A>
	Complete the implementation of the <tt>BinomialTree</tt> class
	declared in Program&nbsp;<A HREF="page374.html#progbinom1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page374.html#progbinom1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>
	by providing suitable definitions for the following member functions:
	<tt>BinomialTree</tt> (constructor), <tt>Count</tt>,
	<tt>Subtree</tt> and <tt>SwapContents</tt>.
	You must also have a complete implementation of the base class
	<tt>GeneralTree</tt>.
	(See Project&nbsp;<A HREF="page298.html#projecttreesgentree" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page298.html#projecttreesgentree"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).
	Write a test program and test your implementation.<LI>
	Complete the implementation of the <tt>BinomialQueue</tt> class
	declared in Program&nbsp;<A HREF="page375.html#progbinom2h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page375.html#progbinom2h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>
	by providing suitable definitions for the following member functions:
	<tt>BinomialQueue</tt> (constructor),
	<tt>BinomialQueue</tt> (destructor),
	<tt>Purge</tt>, <tt>CompareTo</tt>, <tt>Accept</tt> and <tt>NewIterator</tt>.
	You must also have a complete implementation of the
	<tt>BinomialTree</tt> class.
	(See Project&nbsp;<A HREF="page386.html#projectpqueuesbinomtree" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page386.html#projectpqueuesbinomtree"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).
	Write a test program and test your implementation.<LI>
	The binary heap described in this chapter uses an array
	as the underlying foundational data structure.
	Alternatively we may base an implementation on the
	<tt>BinaryTree</tt> class described in Chapter&nbsp;<A HREF="page250.html#chaptrees" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page250.html#chaptrees"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>.
	Implement a concrete priority queue class
	using multiple inheritance to inherit the functionality
	from the <tt>BinaryTree</tt> class (Program&nbsp;<A HREF="page289.html#progbintree1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page289.html#progbintree1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>)
	and the interface from the <tt>PriorityQueue</tt> class
	(Program&nbsp;<A HREF="page353.html#progpqueue1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page353.html#progpqueue1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).<LI>
	Implement a concrete priority queue class
	using the binary search tree class from Chapter&nbsp;<A HREF="page299.html#chapsrchtree" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page299.html#chapsrchtree"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>.
	Specifically, use multiple inheritance to inherit the functionality
	from the <tt>BST</tt> class (Program&nbsp;<A HREF="page312.html#progbst1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page312.html#progbst1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>)
	and the interface from the <tt>PriorityQueue</tt> class
	(Program&nbsp;<A HREF="page353.html#progpqueue1h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page353.html#progpqueue1h"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).
	You will require a complete implementation of the base class
	<tt>BST</tt>.
	(See Project&nbsp;<A HREF="page351.html#projectsrchtreebst" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page351.html#projectsrchtreebst"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>).
	Write a test program and test your implementation.<LI>
	Devise and implement an algorithm to multiply two polynomials:
	<P> <IMG WIDTH=336 HEIGHT=46 ALIGN=BOTTOM ALT="displaymath67112" SRC="img1585.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img1585.gif"  ><P>
	Generate the terms of the result in order
	by putting intermediate product terms into a priority queue.
	I.e., use the priority queue to group terms with the same exponent.
	<b>Hint</b>: See also Project&nbsp;<A HREF="page202.html#projectlistspolymult" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page202.html#projectlistspolymult"><IMG  ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A>.
</OL>
<P>
<HR><A NAME="tex2html6693" HREF="page387.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page387.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html6691" HREF="page352.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page352.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html6687" HREF="page385.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page385.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html6695" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html6696" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <P><ADDRESS>
<img src="bruno.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/bruno.gif" alt="Bruno" align=right>
<a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html">Copyright &#169; 1997</a> by <a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html">Bruno R. Preiss, P.Eng.</a>  All rights reserved.

</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

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