page551.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="tex2html7496" HREF="page552.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7494" HREF="page549.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7490" HREF="page550.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7498" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0016312000000000000000">Running Time Analysis</A></H3><P>The running time of the depth-first traversal methoddepends on the graph representation scheme used.The traversal visits each node in the graph at most once.When a node is visited,all the edges emanating from that node are considered.During a complete traversal enumerates every edge in the graph.<P>Therefore, the worst-case running time for the depth-first traversalof a graph is represented using an adjacency matrix is<P> <IMG WIDTH=398 HEIGHT=19 ALIGN=BOTTOM ALT="displaymath71183" SRC="img2289.gif"  ><P>When adjacency lists are used,the worst case running time for the depth-first traversal method is<P> <IMG WIDTH=413 HEIGHT=16 ALIGN=BOTTOM ALT="displaymath71184" SRC="img2290.gif"  ><P><P>Recall that for a sparse graph graph  <IMG WIDTH=82 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70933" SRC="img2244.gif"  >.If the sparse graph is represented using adjacency listsand if  <IMG WIDTH=126 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline71189" SRC="img2291.gif"  > and  <IMG WIDTH=131 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline71191" SRC="img2292.gif"  >the worst-case running time of the depth-first traversalis simply  <IMG WIDTH=43 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70999" SRC="img2255.gif"  >.<P><HR><A NAME="tex2html7496" HREF="page552.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7494" HREF="page549.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7490" HREF="page550.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7498" 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 + -
显示快捷键?