slide057.html

来自「《Big C++ 》Third Edition电子书和代码全集-Part1」· HTML 代码 · 共 53 行

HTML
53
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta content="blendTrans(Duration=2)" http-equiv="Page-Enter">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Copyright" content="2005 John Wiley & Sons">
  <meta name="Author" content="Kurt Schmidt">
	<script language="JavaScript" src="./config.js"></script>
	<script language="JavaScript" src="./pageFormat.js"></script>
	<script><!-- // Set title on page
		title()
	//--></script>
</head>


<body>
<div onclick="document.location='slide058.html'">
<h2><font color="#009999">23.6 Case Study: Dijkstra's Algorithm</font></h2>
<font size="+1">

<ul>
	<li>A (min) PQ is used to represent the list of possible
		destinations with the relative cost of traveling to them</li>
	<li>Build a resultant map <tt>shortest</tt> of names and distances</li>
	<li>Place the source on the queue, w/distance 0</li>
	<li>Loop while the PQ is not empty:
		<ol>
			<li>Pop element</li>
			<li>If city already visited (in <tt>shortest</tt>), goto 1</li>
			<li>Place city and cost in <tt>shortest</tt></li>
			<li>For each adjacent node in <tt>cities</tt> (loop from
				<tt>lower_bound</tt> to <tt>upper_bound</tt>:
				<ul>
					<li>Add current distance to relative distance, add new entry to
						PQ</li>
				</ul>
			</li>
		</ol>
	</li>
</ul>

</font>

<hr>
<center><small>
	<a href='slide056.html'>prev</a>
	|<a href='slide001.html'>top</a>
	|<a href='slide058.html'>next</a>
</small></center>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?