Topic 2 · Lesson 4 of 4
Exam technique and practice
Exam technique
- Kruskal's: list every arc considered, in order, with include or reject. Prim's: list the arcs in the order they are added. Questions often say "you must list the arcs in the order that you consider them": no list, no marks.
- State the weight of the tree, with units.
- Dijkstra's: fill in every box completely, with working values in the order you wrote them. Do not cross out a value you replaced; write the new, smaller one after it.
- Give the route as a list of vertices (A B E D F) and its length.
- Floyd's: show both tables after each iteration (or as many as the question asks). Many students lose marks by updating the distance table but not the route table.
Common mistakes
- Rejecting an arc in Kruskal's because it is not joined to the tree. Fix: Kruskal's only rejects arcs that make a cycle.
- Stopping Prim's on a matrix too early. Fix: there are arcs; every row must be crossed out.
- Writing a working value that is larger than the existing one. Fix: only write a new working value when it is smaller.
- Making a vertex final because it was found first. Fix: the next final value is always the smallest working value among all unfinished vertices.
- Copying the wrong route entry in Floyd's. Fix: the new entry in row X, column Y is copied from row X, column (the first step towards ), not from row .
Check yourself
- How many arcs are in a minimum spanning tree for a network with 12 vertices?
- Why can Prim's algorithm never create a cycle?
- In Kruskal's algorithm on the example network, at which point would the arc CE (weight 10) be considered, and would it be included?
- In Dijkstra's algorithm, vertex P has working values 19 and 15, and is then made final. What is its final value?
- Using the example network, what is the shortest distance from A to D?
- In Floyd's algorithm with intermediate vertex C, , and . What happens to row A, column D in each table, if row A, column C of the route table is B?
- State one reason why Prim's algorithm is preferred to Kruskal's for large networks stored as tables.
Show answersHide answers
- 11
- Each new arc joins a vertex in the tree to one not yet in it, so it cannot close a loop
- After DF (8), with BD (10); by then the tree is already complete, but if considered it would be rejected, as C and E are already connected
- 15
- 16 (A B E D)
- The distance becomes 9 and the route entry becomes B
- It works directly on the table, without sorting all the arcs first or checking for cycles
Practise this topic
Quiz me on this topic10 questions, marked as you go.Make a practice paperPick the marks and difficulty. Print it with a mark scheme.
Both are part of Premium.