page554.html

来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 39 行

HTML
39
字号
<HTML><HEAD><TITLE>Running Time Analysis</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="tex2html7529" HREF="page555.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7527" HREF="page552.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7523" HREF="page553.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7531" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0016322000000000000000">Running Time Analysis</A></H3><P>The breadth-first traversal enqueues each node in the graph at most once.When a node is dequeued,all the edges emanating from that node are considered.Therefore, a complete traversal enumerates every edge in the graph.<P>The actual running time of the breadth-first traversal methoddepends on the graph representation scheme used.The worst-case running time for the traversalof a graph represented using an adjacency matrix is<P> <IMG WIDTH=333 HEIGHT=19 ALIGN=BOTTOM ALT="displaymath71235" SRC="img2296.gif"  ><P>When adjacency lists are used,the worst case running time for the breadth-first traversal method is<P> <IMG WIDTH=349 HEIGHT=16 ALIGN=BOTTOM ALT="displaymath71236" SRC="img2297.gif"  ><P><P>If the graph is sparse, then  <IMG WIDTH=82 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70933" SRC="img2244.gif"  >.Therefore, if a sparse graph is represented using adjacency listsand if  <IMG WIDTH=108 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline60707" SRC="img668.gif"  >,the worst-case running time of the breadth-first traversalis just  <IMG WIDTH=43 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70999" SRC="img2255.gif"  >.<P><HR><A NAME="tex2html7529" HREF="page555.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7527" HREF="page552.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7523" HREF="page553.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7531" 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 &#169; 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 + -
显示快捷键?