⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page67.html

📁 wqeqwvrw rkjqhwrjwq jkhrjqwhrwq jkhrwq
💻 HTML
字号:
<HTML>
<HEAD>
<TITLE>A Simple Example</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="tex2html2725" HREF="page68.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page68.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="tex2html2723" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2717" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2727" 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="tex2html2728" 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>
<H2><A NAME="SECTION004210000000000000000">A Simple Example</A></H2>
<P>
Consider the function  <IMG WIDTH=163 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59933" SRC="img410.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img410.gif"  >
which is shown in Figure&nbsp;<A HREF="page67.html#figomega" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page67.html#figomega"><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>.
Clearly, <I>f</I>(<I>n</I>) is non-negative for all integers  <IMG WIDTH=38 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59063" SRC="img241.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img241.gif"  >.
We wish to show that  <IMG WIDTH=92 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59939" SRC="img411.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img411.gif"  >.
According to Definition&nbsp;<A HREF="page66.html#defnomega" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.html#defnomega"><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>,
in order to show this we need to find an integer  <IMG WIDTH=16 HEIGHT=15 ALIGN=MIDDLE ALT="tex2html_wrap_inline59043" SRC="img238.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img238.gif"  > and a constant <I>c</I><I>&gt;</I>0
such that for all integers  <IMG WIDTH=46 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline59075" SRC="img242.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img242.gif"  >,  <IMG WIDTH=74 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59947" SRC="img412.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img412.gif"  >.
<P>
As with big oh, it does not matter what the particular constants are--as long as they exist!
E.g., suppose we choose <I>c</I>=1.
Then
<P> <IMG WIDTH=500 HEIGHT=65 ALIGN=BOTTOM ALT="eqnarray1662" SRC="img413.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img413.gif"  ><P>
Since  <IMG WIDTH=84 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59951" SRC="img414.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img414.gif"  > for all values of  <IMG WIDTH=38 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59063" SRC="img241.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img241.gif"  >,
we conclude that  <IMG WIDTH=45 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline59955" SRC="img415.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img415.gif"  >.
<P>
So, we have that for <I>c</I>=1 and  <IMG WIDTH=45 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline59955" SRC="img415.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img415.gif"  >,  <IMG WIDTH=74 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59947" SRC="img412.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img412.gif"  >
for all integers  <IMG WIDTH=46 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline59075" SRC="img242.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img242.gif"  >.
Hence,  <IMG WIDTH=92 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59939" SRC="img411.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img411.gif"  >.
Figure&nbsp;<A HREF="page67.html#figomega" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page67.html#figomega"><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> clearly shows
that the function  <IMG WIDTH=68 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59115" SRC="img249.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img249.gif"  > is less than
the function <I>f</I>(<I>n</I>)=5<I>n</I>-64<I>n</I>+256 for all values of  <IMG WIDTH=38 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59063" SRC="img241.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img241.gif"  >.
Of course, there are many other values of <I>c</I> and  <IMG WIDTH=16 HEIGHT=15 ALIGN=MIDDLE ALT="tex2html_wrap_inline59043" SRC="img238.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img238.gif"  > that will do.
For example, <I>c</I>=2 and  <IMG WIDTH=53 HEIGHT=23 ALIGN=MIDDLE ALT="tex2html_wrap_inline59103" SRC="img248.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img248.gif"  >.
<P>
<P><A NAME="1719">&#160;</A><A NAME="figomega">&#160;</A> <IMG WIDTH=575 HEIGHT=322 ALIGN=BOTTOM ALT="figure1665" SRC="img417.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img417.gif"  ><BR>
<STRONG>Figure:</STRONG> Showing that  <IMG WIDTH=225 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline60011" SRC="img416.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img416.gif"  >.<BR>
<P><HR><A NAME="tex2html2725" HREF="page68.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page68.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="tex2html2723" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2717" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2727" 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="tex2html2728" 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -