📄 page385.html
字号:
<HTML><HEAD><TITLE>Projects</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="tex2html5617" HREF="page386.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5615" HREF="page351.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5611" HREF="page384.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html5619" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION0011700000000000000000">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 introduced in Program <A HREF="page356.html#progbinaryHeapa"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by providing suitable definitions for the following operations: <tt>_compareTo</tt>, <tt>getIsFull</tt>, <tt>accept</tt> and <tt>__iter__</tt>. Write a test program and test your implementation.<LI> <A NAME="projectpqueuesleftist"> </A> Complete the <tt>LeftistHeap</tt> class introduced in Program <A HREF="page363.html#progleftistHeapa"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by providing suitable definitions for the following operations: <tt>__init__</tt>, <tt>swapContentsWith</tt> and <tt>swapSubtrees</tt>. You will require a complete implementation of the base class <tt>BinaryTree</tt>. (See Project <A HREF="page297.html#projecttreesbintree"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>). Write a test program and test your implementation.<LI> <A NAME="projectpqueuesbinomtree"> </A> Complete the implementation of the <tt>BinomialTree</tt> class introduced in Program <A HREF="page372.html#progbinomialQueueh"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by providing suitable definitions for the following operations: <tt>__init__</tt>, <tt>getCount</tt> and <tt>swapContentsWith</tt>. You must also have a complete implementation of the base class <tt>GeneralTree</tt>. (See Project <A HREF="page297.html#projecttreesgentree"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>). Write a test program and test your implementation.<LI> Complete the implementation of the <tt>BinomialQueue</tt> class introduced in Program <A HREF="page374.html#progbinomialQueuea"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by providing suitable definitions for the following methods: <tt>__init__</tt>, <tt>purge</tt>, <tt>_compareTo</tt>, <tt>accept</tt> and <tt>__iter__</tt>. You must also have a complete implementation of the <tt>BinomialTree</tt> class. (See Project <A HREF="page385.html#projectpqueuesbinomtree"><IMG ALIGN=BOTTOM ALT="gif" SRC="../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 <A HREF="page251.html#chaptrees"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>. Implement a priority queue class that extends the <tt>BinaryTree</tt> class (Program <A HREF="page287.html#progbinaryTreea"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>) and the abstract <tt>PriorityQueue</tt> class (Program <A HREF="page352.html#progpriorityQueuea"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>).<LI> Implement a priority queue class using the binary search tree class from Chapter <A HREF="page298.html#chapsrchtree"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>. Specifically, extend the <tt>BinarySearchTree</tt> class (Program <A HREF="page311.html#progbinarySearchTreea"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>) and the abstract <tt>PriorityQueue</tt> class (Program <A HREF="page352.html#progpriorityQueuea"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>). You will require a complete implementation of the base class <tt>BinarySearchTree</tt>. (See Project <A HREF="page350.html#projectsrchtreebst"><IMG ALIGN=BOTTOM ALT="gif" SRC="../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=47 ALIGN=BOTTOM ALT="displaymath66487" SRC="img1533.gif" ><P> Generate the terms of the result in order by putting intermediate product terms into a priority queue. That is, use the priority queue to group terms with the same exponent. <b>Hint</b>: See also Project <A HREF="page204.html#projectlistspolymult"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.</OL><P><HR><A NAME="tex2html5617" HREF="page386.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html5615" HREF="page351.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html5611" HREF="page384.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html5619" 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 © 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -