page65.html

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

HTML
68
字号
<HTML>
<HEAD>
<TITLE>Conventions for Writing Big Oh Expressions</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="tex2html2699" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2697" HREF="page57.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page57.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="tex2html2693" HREF="page64.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page64.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="tex2html2701" 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="tex2html2702" 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="SECTION004180000000000000000">Conventions for Writing Big Oh Expressions</A></H2>
<P>
Certain conventions have evolved which concern
how big oh expressions are normally written:
<UL><LI>
	First, it is common practice when writing big oh expressions
	to drop all but the most significant terms.
	Thus, instead of  <IMG WIDTH=133 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59875" SRC="img400.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img400.gif"  > we simply write  <IMG WIDTH=40 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59179" SRC="img261.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img261.gif"  >.<LI>
	Second, it is common practice to drop constant coefficients.
	Thus, instead of  <IMG WIDTH=48 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59879" SRC="img401.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img401.gif"  >, we simply write  <IMG WIDTH=40 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59179" SRC="img261.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img261.gif"  >.
	As a special case of this rule,
	if the function is a constant,
	instead of, say O(1024), we simply write <I>O</I>(1).
</UL>
<P>
Of course, in order for a particular big oh expression to be
the most useful, we prefer to find a <em>tight</em> asymptotic bound
(see Definition&nbsp;<A HREF="page63.html#defntightness" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page63.html#defntightness"><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>).
For example, while it is not wrong to write  <IMG WIDTH=123 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59885" SRC="img402.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img402.gif"  >,
we prefer to write <I>f</I>(<I>n</I>)=<I>O</I>(<I>n</I>), which is a tight bound.
<P>
Certain big oh expressions occur so frequently that they are given names.
Table&nbsp;<A HREF="page65.html#tblbigohnames" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page65.html#tblbigohnames"><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> lists some of the commonly occurring
big oh expressions and the usual name given to each of them.
<P>
<P><A NAME="1635">&#160;</A>
<P>
    <A NAME="tblbigohnames">&#160;</A>
    <DIV ALIGN=CENTER><P ALIGN=CENTER><TABLE COLS=2 BORDER FRAME=HSIDES RULES=GROUPS>
<COL ALIGN=LEFT><COL ALIGN=LEFT>
<TBODY>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP>
	    expression </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> name </TD></TR>
</TBODY><TBODY>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP><I>O</I>(1) </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> constant<A NAME=1640>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=56 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline59891" SRC="img403.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img403.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> logarithmic<A NAME=1641>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=63 HEIGHT=29 ALIGN=MIDDLE ALT="tex2html_wrap_inline59893" SRC="img404.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img404.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> log squared<A NAME=1642>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	    <I>O</I>(<I>n</I>) </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> linear<A NAME=1643>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=68 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline59897" SRC="img405.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img405.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> <I>n</I> log <I>n</I> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=40 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59179" SRC="img261.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img261.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> quadratic<A NAME=1644>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=39 HEIGHT=25 ALIGN=MIDDLE ALT="tex2html_wrap_inline59491" SRC="img332.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img332.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> cubic<A NAME=1645>&#160;</A> </TD></TR>
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> 
	     <IMG WIDTH=39 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline59907" SRC="img406.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img406.gif"  > </TD><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP> exponential<A NAME=1646>&#160;</A> </TD></TR>
</TBODY>
<CAPTION ALIGN=BOTTOM><STRONG>Table:</STRONG> The Names of Common Big Oh Expressions</CAPTION></TABLE>
</P></DIV><P><HR><A NAME="tex2html2699" HREF="page66.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page66.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="tex2html2697" HREF="page57.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page57.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="tex2html2693" HREF="page64.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page64.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="tex2html2701" 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="tex2html2702" 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 + -
显示快捷键?