page43.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 69 行
HTML
69 行
<HTML><HEAD><TITLE>Solving Recurrence Relations-Repeated Substitution</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="tex2html1702" HREF="page44.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html1700" HREF="page42.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html1696" HREF="page42.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html1704" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION002151000000000000000">Solving Recurrence Relations-Repeated Substitution</A></H3><P>In this section we present a technique for solving a recurrencerelation such as Equation <A HREF="page42.html#eqnmodelrecurrence"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> called<em>repeated substitution</em><A NAME=487> </A>.The basic idea is this:Given that <IMG WIDTH=147 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57767" SRC="img55.gif" >,then we may also write <IMG WIDTH=174 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57769" SRC="img56.gif" >, provided <I>n</I><I>></I>1.Since <I>T</I>(<I>n</I>-1) appears in the right-hand side of the former equation,we can substitute for it the entire right-hand side of the latter.By repeating this process we get<P> <IMG WIDTH=500 HEIGHT=142 ALIGN=BOTTOM ALT="eqnarray488" SRC="img57.gif" ><P><P>The next step takes a little intuition:We must try to discern the pattern which is emerging.In this case it is obvious:<P><P> <IMG WIDTH=330 HEIGHT=16 ALIGN=BOTTOM ALT="displaymath57765" SRC="img58.gif" ><P>where <IMG WIDTH=68 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57775" SRC="img59.gif" >.Of course, if we have doubts about our intuition,we can always check our result by induction:<P> extbfProof (By Induction).<b>Base Case</b>Clearly the formula is correct for <I>k</I>=1,since <IMG WIDTH=271 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57779" SRC="img60.gif" >.<P><b>Inductive Hypothesis</b>Assume that <IMG WIDTH=157 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57781" SRC="img61.gif" > for <IMG WIDTH=91 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline57783" SRC="img62.gif" >.By this assumption<P><A NAME="eqnmodela"> </A> <IMG WIDTH=500 HEIGHT=16 ALIGN=BOTTOM ALT="equation493" SRC="img63.gif" ><P>Note also that using the original recurrence relation we can write<P><A NAME="eqnmodelb"> </A> <IMG WIDTH=500 HEIGHT=16 ALIGN=BOTTOM ALT="equation496" SRC="img64.gif" ><P>for <IMG WIDTH=36 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57785" SRC="img65.gif" >.Substituting Equation <A HREF="page43.html#eqnmodela"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>in the right-hand side of Equation <A HREF="page43.html#eqnmodelb"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> gives<P> <IMG WIDTH=500 HEIGHT=40 ALIGN=BOTTOM ALT="eqnarray501" SRC="img66.gif" ><P>which makes the formula correct for <I>l</I>+1.Therefore, by induction on <I>l</I>, our formula is correctfor all <IMG WIDTH=69 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57791" SRC="img67.gif" >.<P>So, we have shown that <IMG WIDTH=157 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57781" SRC="img61.gif" >, for <IMG WIDTH=68 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline57775" SRC="img59.gif" >.Now, if <I>n</I> was known,we would repeat the process of substitution until we got <I>T</I>(0)on the right hand side.The fact that <I>n</I> is unknown should not deter us--we get <I>T</I>(0) on the right hand side when <I>n</I>-<I>k</I>=0.That is, <I>k</I>=<I>n</I>.Letting <I>k</I>=<I>n</I> we get<P><A NAME="eqnmodelfactorialc"> </A> <IMG WIDTH=500 HEIGHT=64 ALIGN=BOTTOM ALT="eqnarray503" SRC="img68.gif" ><P>where <IMG WIDTH=176 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline57761" SRC="img53.gif" > and <IMG WIDTH=350 HEIGHT=21 ALIGN=MIDDLE ALT="tex2html_wrap_inline57763" SRC="img54.gif" >.<P><HR><A NAME="tex2html1702" HREF="page44.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html1700" HREF="page42.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html1696" HREF="page42.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html1704" 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 + -
显示快捷键?