File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ These are:
3333
3434
3535- "Finalised" nodes, for which the shortest or least costly path back to the start node has already
36- been finalised, that is the final parent node has been determined and is recorded;
36+ been finalised (see below for further explanation of this),
37+ that is the final parent node has been determined and is recorded;
3738
3839- "Frontier" nodes, that are not finalised but are connected to a finalised node by a single edge; and
3940
@@ -53,6 +54,14 @@ been finalised
5354have their costs recomputed. Other algorithms use other data structures to keep track
5455of the frontier nodes.
5556
57+ Saying the finalised nodes have "the least costly path" back to the start
58+ node may be a little misleading: Prim's algorithm uses the length of just
59+ * the first edge of the path* as the cost. At each step, Prim's algorithm
60+ chooses the node with the least * incremental* cost increase for the tree
61+ being constructed. Throughout the execution, if finalised has size * N* ,
62+ it contains the smallest tree with * N* nodes that includes the start node.
63+ The paths from each node back to the start are generally not the shortest.
64+
5665In the presentation here, we do not give details of how the priority
5766queue is implemented, but just emphasise it is a collection of nodes
5867with associated costs and the node with the minimum cost is selected each
Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ MergeAll
5858FirstRun
5959 mid <- left \\B mid
6060 while mid < size and A[mid] <= A[mid+1] \\B FirstRunWhile
61- \\Expl{ Scan until we find an element that is less than the previous
62- element (or we reach the end).
61+ \\Expl{ Scan until we find the end of the run: the next element is less
62+ than the current element (or we reach the end).
6363 \\Expl}
6464 \\In{
6565 mid <- mid + 1 \\B mid++
@@ -70,8 +70,8 @@ FirstRun
7070SecondRun
7171 right <- mid + 1 \\B right
7272 while right < size and A[right] <= A[right+1] \\B SecondRunWhile
73- \\Expl{ Scan until we find an element that is less than the previous
74- element (or we reach the end).
73+ \\Expl{ Scan until we find the end of the run: the next element is less
74+ than the current element (or we reach the end).
7575 \\Expl}
7676 \\In{
7777 right <- right + 1 \\B right++
You can’t perform that action at this time.
0 commit comments