page204.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 57 行
HTML
57 行
<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="tex2html3547" HREF="page205.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3545" HREF="page168.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3541" HREF="page203.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3549" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION007400000000000000000">Projects</A></H1><P><OL><LI> Write a visitor to solve each of the following problems: <OL><LI> Find the smallest element of a list.<LI> Find the largest element of a list.<LI> Compute the sum of all the elements of a list.<LI> Compute the product of all the elements of a list. </OL><LI> Design and implement a class called <tt>OrderedListAsDoublyLinkedList</tt> which represents an ordered list using a doubly-linked list. Select one of the approaches shown in Figure <A HREF="page165.html#figdeque2"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<LI> Consider the <tt>Polynomial</tt> class given in Program <A HREF="page189.html#progpolynomialAsOrderedLista"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>. Implement a method that computes the value of a polynomial, say <I>p</I>(<I>x</I>), for a given value of <I>x</I>. <b>Hint</b>: Use a visitor that visits all the terms in the polynomial and accumulates the result.<LI> <A NAME="projectlistspolymult"> </A> Devise and implement an algorithm to multiply two polynomials. <b>Hint</b>: Consider the identity <P> <IMG WIDTH=411 HEIGHT=47 ALIGN=BOTTOM ALT="displaymath61471" SRC="img820.gif" ><P> Write a method to multiply a <tt>Polynomial</tt> by a <tt>Term</tt> and use the polynomial addition operator defined in Program <A HREF="page201.html#progpolynomialAsSortedLista"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<LI> Devise and implement an algorithm to compute the <IMG WIDTH=20 HEIGHT=14 ALIGN=BOTTOM ALT="tex2html_wrap_inline61477" SRC="img821.gif" > power of a polynomial, where <I>k</I> is a positive integer. What is the running time of your algorithm?<LI> For some calculations it is necessary to have very large integers, i.e., integers with an arbitrarily large number of digits. We can represent such integers using lists. Design and implement a class for representing arbitrarily large integers. Your implementation should include operations to add, subtract, and multiply such integers, and to compute the <IMG WIDTH=20 HEIGHT=14 ALIGN=BOTTOM ALT="tex2html_wrap_inline61477" SRC="img821.gif" > power of such an integer, where <I>k</I> is a <em>small</em> positive integer. <b>Hint</b>: Base your design on the <tt>Polynomial</tt> class given in Program <A HREF="page189.html#progpolynomialAsOrderedLista"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.</OL><P><HR><A NAME="tex2html3547" HREF="page205.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3545" HREF="page168.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3541" HREF="page203.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3549" 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 + =
减小字号Ctrl + -
显示快捷键?