Documente Academic
Documente Profesional
Documente Cultură
eBook
included
DECISION
MATHEMATICS 1
STUDENT BOOK
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
DECISION MATHEMATICS 1
Student Book
Published by Pearson Education Limited, 80 Strand, London, WC2R 0RL. Endorsement Statement
In order to ensure that this resource offers high-quality support for the associated
www.pearsonglobalschools.com Pearson qualification, it has been through a review process by the awarding body.
This process confirms that this resource fully covers the teaching and learning
Copies of official specifications for all Pearson qualifications may be found on the content of the specification or part of a specification at which it is aimed. It also
website: https://qualifications.pearson.com confirms that it demonstrates an appropriate balance between the development
of subject skills, knowledge and understanding, in addition to preparation for
Text © Pearson Education Limited 2018 assessment.
Edited by Linnet Bruce and Eric Pradel
Typeset by Tech-Set Ltd, Gateshead, UK Endorsement does not cover any guidance on assessment activities or processes
Original illustrations © Pearson Education Limited 2018 (e.g. practice questions or advice on how to answer assessment questions)
Illustrated by © Tech-Set Ltd, Gateshead, UK included in the resource, nor does it prescribe any particular approach to the
Cover design by © Pearson Education Limited teaching or delivery of a related course.
The rights of Martin Crozier, Susie Jameson, Keith Pledger, Peter Sherran, While the publishers have made every attempt to ensure that advice on the
Joe Skrakowski and Harry Smith to be identified as the authors of this work have qualification and its assessment is accurate, the official specification and
been asserted by them in accordance with the Copyright, Designs and Patents associated assessment guidance materials are the only authoritative source of
Act 1988. information and should always be referred to for definitive guidance.
First published 2018 Pearson examiners have not contributed to any sections in this resource relevant to
examination papers for which they have responsibility.
21 20 19 18
10 9 8 7 6 5 4 3 2 1 Examiners will not use endorsed resources as a source of material for any
assessment set by Pearson. Endorsement of a resource does not mean that the
British Library Cataloguing in Publication Data resource is required to achieve this Pearson qualification, nor does it mean that it
A catalogue record for this book is available from the British Library is the only suitable material available to support the qualification, and any resource
lists produced by the awarding body shall include this and other appropriate
ISBN 978 1 292244 56 3 resources.
Copyright notice
All rights reserved. No part of this may be reproduced in any form or by any means
(including photocopying or storing it in any medium by electronic means and
whether or not transiently or incidentally to some other use of this publication)
without the written permission of the copyright owner, except in accordance with
the provisions of the Copyright, Designs and Patents Act 1988 or under the terms
of a licence issued by the Copyright Licensing Agency, Barnard's Inn, 86 Fetter
Lane, London, EC4A 1EN (www.cla.co.uk). Applications for the copyright owner’s
written permission should be addressed to the publisher.
Picture Credits
The authors and publisher would like to thank the following individuals and
organisations for permission to reproduce photographs:
Alamy: ZUMA Press, Inc 1, Iain Masterton 29, Andriy Popov 52, Roy LANGSTAFF
106, Nataliya Hora 132, wu kailiang 170; Getty Images: iStock Unreleased 32;
Science Photo Library: Peter Menzel 89
COURSE STRUCTURE iv
ABOUT THIS BOOK vi
QUALIFICATION AND ASSESSMENT OVERVIEW viii
EXTRA ONLINE CONTENT x
1 ALGORITHMS 1
2 GRAPHS AND NETWORKS 29
3 ALGORITHMS ON GRAPHS 49
REVIEW EXERCISE 1 76
4 ROUTE INSPECTION 81
5 THE TRAVELLING SALESMAN PROBLEM 95
6 CRITICAL PATH ANALYSIS 121
7 LINEAR PROGRAMMING 154
REVIEW EXERCISE 2 187
EXAM PRACTICE 199
GLOSSARY 205
ANSWERS 208
INDEX 255
iv COURSE STRUCTURE
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
REVIEW EXERCISE 1 76
COURSE STRUCTURE v
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
• Transferable skills are embedded throughout this book, in the exercises and in some examples
• These skills are signposted to show students which skills they are using and developing
Step-by-step worked
examples focus on the
key types of questions
you’ll need to tackle
QUALIFICATION AND
ASSESSMENT OVERVIEW
Qualification and content overview
Decision Mathematics 1 (D1) is an optional unit in the following qualifications:
International Advanced Subsidiary in Mathematics
International Advanced Subsidiary in Further Mathematics
International Advanced Level in Mathematics
International Advanced Level in Further Mathematics
Assessment overview
The following table gives an overview of the assessment for this unit.
We recommend that you study this information closely to help ensure that you are fully prepared for
this course and know exactly what to expect in the assessment.
Assessment objective
D1 AO1 AO2 AO3 AO4 AO5
Marks out of 75 20–25 20–25 15–20 5–10 5–10
26_ 3 –33_ 3 26_ 3 –33_ 3 20–26_ 3 6_ 3 –13_ 3 6_ 3 –13_ 3
2 1 2 1 2 2 1 2 1
%
Calculators
Students may use a calculator in assessments for these qualifications. Centres are responsible for
making sure that calculators used by their students meet the requirements given in the table below.
Students are expected to have available a calculator with at least the following keys: +, –, ×, ÷, π, x2,
__ __ 1
x
√ , , xy, ln x, ex, x!, sine, cosine and tangent and their inverses in degrees and decimals of a degree,
x
and in radians; memory.
Prohibitions
Calculators with any of the following facilities are prohibited in all examinations:
• databanks
• retrieval of text or formulae
• built-in symbolic algebra manipulations
• symbolic differentiation and/or integration
• language translators
• communication with other machines or the internet
x EXTRA ONLINE CONTENT
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
SolutionBank
SolutionBank provides a full worked solution for questions in the book.
Download all the solutions as a PDF or quickly find the solution you need online.
Use of technology y
Interact with the mathematics you are learning Explore the mathematics you are learning and
using GeoGebra's easy-to-use tools gain confidence in using a graphic calculator
Calculator tutorials
Our helpful video tutorials will
guide you through how to use
your calculator in the exams.
They cover both Casio's scientific
and colour graphic calculators.
Online
Work out each coefficient quickly using Step-by-step guide with audio instructions
the nCr and power functions on your calculator. on exactly which buttons to press and what
should appear on your calculator's screen
ALGORITHMS CHAPTER 1 1
1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1.1
1.2
Learning objectives
After completing this chapter you should be able to:
● Use and understand an algorithm given in words → pages 2–5
● Understand how flow charts can be used
to describe algorithms → pages 5–10
Find:
a the output when the input is 11
b the input when the output is 99. Efficient sorting algorithms such as
______ the quick sort allow software that
2 Given that x1 = 5, use the formula xn + 1 = √x n + 4 governs self-drive cars to prioritise
to find x2, x3 and x4, giving your answers to 3 s.f. input information and react quickly
← International GCSE Mathematics and safely.
2 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
At the end of the street turn right and Affix base (B) to leg (A) Dice two large onions.
go straight over the crossroads, take the using screw (F ) and ... Slice 100 g mushrooms.
third left after the school, then ... Grate 100 g cheese.
1 Let n = 1, A = 1, B = 1.
2 Print A and B.
3 Let C = A + B.
These are not equations.
4 Print C.
They are instructions that mean:
5 Let n = n + 1, A = B, B = C. ● replace n by n + 1 (add 1 to n)
● A takes B’s current value
6 If n < 5, go to step 3.
● B takes C’s current value
7 If n = 5, stop.
a A B
In each row, the number in the left-hand column
29 34 is halved and the number in the right-hand
14 68 column is doubled.
7 136
Step 4 means that rows where the number in the
3 272 left-hand column is even must be deleted before
1 544 summing the right-hand column.
Total 986
So 29 × 34 = 986
b A B
66 56
33 112
16 224
8 448 Each deleted row has an even number in its left-
hand column.
4 896
2 1792
1 3584
Total 3696
So 66 × 56 = 3696
ALGORITHMS CHAPTER 1 5
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
The boxes in a flow chart are linked by arrowed lines. As with an algorithm written in words,
you need to follow each step in order.
6 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Box 2 Let n = 0
Box 4 Let E = 2n
Box 5 Print E
Is No
Box 6 n > 10? A decision box will contain a question to
which the answer is either ‘yes’ or ‘no’.
Yes
Box 7 Stop
a n E Box 6 b n E Box 6
0 0
1 2 No 1 3 No
2 4 No 2 6 No
3 6 No 3 9 No
4 8 No 4 12 No
In a trace table each
5 10 No 5 15 No
step must be made
6 12 No 6 18 No
clear.
7 14 No 7 21 No
8 16 No 8 24 No
9 18 No 9 27 No
10 20 Yes 10 30 Yes
Output is 2, 4, 6, 8, 10, 12, Output is 3, 6, 9, 12, 15, 18,
14, 16, 18, 20 21, 24, 27, 30
This gives the first ten multiples of
3 rather than the first ten multiples
of 2.
ALGORITHMS CHAPTER 1 7
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
This flow chart can be used to find the roots of an equation of the form ax2 + bx + c = 0.
Start
Input a, b, c
Let d = b2 – 4ac
Is Yes
Print ‘no real roots’
d < 0? You should recognise d
No as the discriminant of
Is Yes the equation.
Let x = – b Print ‘equal roots are’ x
d = 0? 2a ← Pure 1 Section 2.5
No
Let x1 = – b + d
2a
Let x2 = – b – d
2a
Stop
a a b c d d < 0? d = 0? x1 x2
__
11
6 −5 −11 289 No No 6 −1
roots are __
11
6 and −1
b a b c d d < 0? d = 0? x
1 −6 9 0 No Yes 3
equal roots are 3
c a b c d d < 0?
4 3 8 −119 Yes
no real roots
8 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Box 2 4 No
Box 3 7 Box 7 Print ‘Output is’ A
Box 4 Yes
Box 5 7
Stop
Box 6 Yes
Box 2 5
Box 3 11
This is quite complicated because it has questions
Box 4 No
and a list of data. Tackle one step at a time.
Box 6 No
Box 7 Output is 7
The algorithm selects the smallest number The box numbers have been included to help
from a list. you to follow the algorithm. You do not need to
include them in your exam.
c Which box would need to be altered if the algorithm was to be applied to a list of 8 numbers?
ALGORITHMS CHAPTER 1 9
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Is Yes
| a – b | < 0.001? Print b Stop
No
Let a = b
Is Yes
r = 0? Print b Stop
No
Let a = b, b = r
(4 marks) No
b Explain what is achieved by this flow chart. (2 marks) Stop
A=A–B
c Given that A = kB for some positive integer
k, write down the output of the flow chart. (1 mark)
10 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Use a bubble sort algorithm to arrange the list below into ascending order.
24 18 37 11 15 30
Hint
In your exam you may be asked to show
24 18 37 11 15 30 1st comparison: swap
each comparison for one pass, but generally
18 24 37 11 15 30 2nd comparison: leave
you will only be required to give the state of
18 24 37 11 15 30 3rd comparison: swap the list after each pass.
18 24 11 37 15 30 4th comparison: swap
18 24 11 15 37 30 5th comparison: swap 37 is already in its final position. It is now not
18 24 11 15 30 37 End of first pass in the working list. We now return to the start
After the second pass the list becomes of the working list for the second pass.
18 11 15 24 30 37
After the third pass, the last three items are
After the third pass the list is
guaranteed to be in their final positions.
11 15 18 24 30 37 In this example, the list is fully ordered
After the fourth pass the list is but the algorithm requires another pass to
11 15 18 24 30 37 be made.
No swaps were made in the fourth pass,
so the list is in order.
A list of n letters is to be sorted into alphabetical order, starting at the left-hand end of the list.
a Describe how to carry out the first pass of a bubble sort on the letters in the list.
b Carry out the first pass of a bubble sort to arrange the letters in the word
ALGORITHM into alphabetical order, showing every step of the working.
c Show the order of the letters at the end of the second pass.
a Starting at the beginning of the list, compare the first two letters. If they
are in alphabetical order, leave them in position, otherwise swap them.
Continue through the list, to the end, comparing every pair of letters in
the same way.
b A L G O R I T H M 1st comparison: leave
A L G O R I T H M 2nd comparison: swap
A G L O R I T H M 3rd comparison: leave
A G L O R I T H M 4th comparison: leave
A G L O R I T H M 5th comparison: swap
A G L O I R T H M 6th comparison: leave
A G L O I R T H M 7th comparison: swap
A G L O I R H T M 8th comparison: swap
A G L O I R H M T
At the end of the first pass, the last letter is
c A G L I O H M R T
guaranteed to be in its correct place.
12 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
39 57 72 39 17 24 48 39 < 57 so swap
57 39 72 39 17 24 48 39 < 72 so swap Watch
out Read the question carefully. You
57 72 39 39 17 24 48 39 ≮ 39 so leave need to sort the list into descending order.
57 72 39 39 17 24 48 39 ≮ 17 so leave
57 72 39 39 17 24 48 17 < 24 so swap
57 72 39 39 24 17 48 17 < 48 so swap
57 72 39 39 24 48 17
After 1st pass: 57 72 39 39 24 48 17
After 2nd pass: 72 57 39 39 48 24 17
Note that the 48 is now between the two 39s.
After 3rd pass: 72 57 39 48 39 24 17 Do not treat the two 39s as one term.
After 4th pass: 72 57 48 39 39 24 17
After 5th pass: 72 57 48 39 39 24 17 Make sure that you make a statement like
No swaps in 5th pass, so the list is in order. this to show that no swaps have been made
and you have completed the algorithm.
2 Perform a bubble sort to arrange these place names into alphabetical order.
Chester York Stafford Bridlington Burton Cranleigh Evesham
In doing the quick sort, the first pass will place the pivot item in its correct position in the list.
We then repeat this until all items are chosen as pivots, and then the list is in order. You will need
to write that all items are chosen as pivots, which means that they are in order.
Here is the quick sort algorithm, used to sort a list into ascending order.
The number of pivots could double at each pass. There is 1 pivot at the first pass, there could be
2 at the second, 4 at the third, 8 at the fourth, and so on.
14 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Use the quick sort algorithm to arrange the numbers below into ascending order.
21 24 42 29 23 13 8 39 38
n+1
21 24 42 29 23 13 8 39 38 For n items, the pivot will be the _____
th
item,
2
rounding up if necessary.
There are 9 numbers in the list so the
21 13 8
9+1
midpoint will be _____ = 5, so the pivot is
2
21 13 8 23 the 5th number in the list. Circle it.
8 13 21 23 24 29 38 39 42
We can choose only two pivots this time. Each
number has been chosen as a pivot, so the list
is in order.
Example 11 SKILLS PROBLEM-SOLVING
Use the quick sort algorithm to arrange the list below into descending order.
37 20 17 26 44 41 27 28 50 17
There are 10 items in the list so the
37 20 17 26 44 41 27 28 50 17 (10+1)
midpoint will be ______
= 5.5, and so the
2
pivot is the 6th number in the list. Circle it.
44 50 41 37 20 17 26 27 28 17
Numbers greater than the pivot are to the
left of the pivot, those smaller than the
50 44 41 37 27 28 26 20 17 17 pivot are to the right, keeping the numbers
in order. Numbers equal to the pivot may
go either side, but must be dealt with in
50 44 41 37 28 27 26 20 17 17 the same way each time you do a pass.
2 Use the quick sort algorithm to arrange the list below into:
a ascending order b descending order
22 17 25 30 11 18 20 14 7 29
E/P 5 A list of n items is to be written in ascending order using the bubble sort algorithm.
a Find an expression, in terms of n, for the maximum number of comparisons to be made.
(2 marks)
b Describe a situation where a bubble sort might be quicker than a quick sort. (2 marks)
c Decide whether a bubble sort or a quick sort will be quicker in the following cases:
i 1 2 3 7 4 5 6
ii
2 3 4 5 6 7 1
Explain how you made your decisions. (4 marks)
16 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Challenge
SKILLS You will need a pack of ordinary playing cards, with any jokers removed. Hint
The final order
INNOVATION A pack of playing cards has 52 cards, split into 4 suits:
should be:
Hearts ♥ Diamonds ♦ Clubs ♣ Spades ♠ A♥, 2♥, …, K♥, A♣, 2♣, …,
There are 13 cards in each suit, as follows: K♣, A♦, …, K♦, A♠, …, K♠
Ace (1), 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack (11), Queen (12), King (13)
a Use the quick sort algorithm to sort the cards into ascending order,
from Ace to King within each suit and with the suits in the order: Hearts,
Clubs, Diamonds, Spades. Follow these steps:
1 Shuffle the pack thoroughly and hold it face up.
2 Remove the 27th card and place it face up. This is your pivot card.
3 Go through the pack from the top. Place the cards into two piles
depending on whether they are lower or higher than the pivot card.
4 Repeat these steps with each new pile, choosing the card halfway
through the pile as the pivot card.
Record the total number of passes needed to sort the deck completely.
b Once the cards are in order, what single change could be made so that a
bubble sort would require 51 passes to put the cards back in order?
b
a
b
b b
a
a a a a a
ALGORITHMS CHAPTER 1 17
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Similar problems are: loading cars of different lengths onto a ferry with several lanes of equal
length, a plumber needing to cut sections from lengths of copper pipe, or recording music tracks
onto a set of CDs.
You need to be able to apply three different bin-packing algorithms, and be aware of their
strengths and weaknesses.
■ The three bin-packing algorithms are: first-fit, first-fit decreasing and full-bin.
It is useful to first find a lower bound for the number
Notation
An optimal solution is one
of bins needed. There is no guarantee that you will be
that cannot be improved upon. For bin
able to pack the items into this number of bins, but it
packing, an optimal solution will use the
will tell you if you have found an optimal solution.
smallest possible number of bins.
0.3 + 0.7 + 0.8 + 0.8 + 1.0 + 1.1 + 1.1 + 1.2 Sum the heights and divide by the bin size.
+ 1.5 = 8.5 m You must always round up to determine the
8.5
____ lower bound.
= 4.25 bins
2
So a minimum of 5 bins will be needed. Watch
out In practice, it may not be possible
to pack these boxes into 5 bins. The lower bound
simply tells us that at least 5 bins will be needed.
Use the first-fit algorithm to pack the following items into bins of size 20. (The numbers in brackets
are the size of the item.) State the number of bins used and the amount of wasted space.
A(8) B(7) C(14) D(9) E(6) F(9) G(5) H(15) I(6) J(7) K(8)
■ The first-fit decreasing algorithm requires the items to be in descending order before applying
the algorithm.
First-fit decreasing algorithm
Apply the first-fit decreasing algorithm to the data given in Example 13.
Sort the data into descending order: H(15) goes into bin 1, leaving space of 5.
H(15) C(14) D(9) F(9) A(8) K(8) B(7) J(7) E(6) I(6) G(5) C(14) goes into bin 2, leaving space of 6.
D(9) goes into bin 3, leaving space of 11.
G(5) E(6) I(6) F(9) goes into bin 3, leaving space of 2.
A(8) goes into bin 4, leaving space of 12.
F(9)
K(8) K(8) goes into bin 4, leaving space of 4.
J(7)
B(7) goes into bin 5, leaving space of 13.
H(15) C(14) J(7) goes into bin 5, leaving space of 6.
D(9) A(8) B(7) E(6) goes into bin 2, leaving space of 0.
I(6) goes into bin 5, leaving space of 0.
Bin 1 Bin 2 Bin 3 Bin 4 Bin 5 G(5) goes into bin 1, leaving space of 0.
This used 5 bins and there are
2 + 4 = 6 units of wasted space.
ALGORITHMS CHAPTER 1 19
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ Full-bin packing uses inspection to select items that will combine to fill bins.
Remaining items are packed using the first-fit algorithm.
Full-bin packing
1 Use observation to find combinations of items that will fill a bin. Pack these items first.
2 Any remaining items are packed using the first-fit algorithm.
A(8) B(7) C(10) D(11) E(13) F(17) G(4) H(6) I(12) J(14) K(9)
The items above are to be packed in bins of size 25.
a Determine the lower bound for the number of bins.
b Apply the full-bin algorithm.
c Is your solution optimal? Give a reason for your answer.
a 111 ÷ 25 = 4.44
So lower bound is 5 bins.
b Three groupings of numbers that sum to
25 can be made as follows:
8 + 7 + 10 = 25
11 + 14 = 25
13 + 12 = 25 The first three bins are full bins.
C(10) I(12)
J(14)
B(7)
D(11) E(13)
A(8)
A plumber needs to cut the following lengths of copper pipe. (Lengths are in metres.)
A(0.8) B(0.8) C(1.4) D(1.1) E(1.3) F(0.9) G(0.8) H(0.9) I(0.8) J(0.9)
The pipe comes in lengths of 2.5 m.
a Calculate the lower bound of the number of lengths of pipe needed.
b Use the first-fit decreasing algorithm to determine how the required lengths may be cut from the
2.5 m lengths.
c Use full-bin packing to find an optimal solution.
0.8 + 0.8 + 1.4 + 1.1 + 1.3 + 0.9 + 0.8 + 0.9 + 0.8 + 0.9
a ____________________________________________________
2.5
= 3.88
Since a sort was not asked for, this can
So at least 4 lengths are required.
be done by inspection.
b Sorting into descending order,
C(1.4), E(1.3), D(1.1), F(0.9), H(0.9),
J(0.9), A(0.8), B(0.8), G(0.8), I(0.8) C goes into bin 1, leaving space of 1.1.
E goes into bin 2, leaving space of 1.2.
D goes into bin 1, leaving space of 0.
D(1.1) G(0.8)
F(0.9) F goes into bin 2, leaving space of 0.3.
H goes into bin 3, leaving space of 1.6.
J(0.9)
B(0.8) J goes into bin 3, leaving space of 0.7.
A goes into bin 4, leaving space of 1.7.
C(1.4) E(1.3)
H(0.9) A(0.8) I(0.8) B goes into bin 4, leaving space of 0.9.
G goes into bin 4, leaving space of 0.1.
Bin 1 Bin 2 Bin 3 Bin 4 Bin 5 I goes into bin 5, leaving space of 1.7.
c By inspection,
In part a we found that at least 4
C(1.4) + D(1.1) = 2.5
lengths would be needed, so this
F(0.9) + A(0.8) + B(0.8) = 2.5
solution is optimal since it uses 4
J(0.9) + G(0.8) + I(0.8) = 2.5
lengths.
A full-bin solution is:
B(0.8) I(0.8)
D(1.1)
H(0.9)
A(0.8) G(0.8)
C(1.4) E(1.3)
F(0.9) J(0.9)
1 18 4 23 8 27 19 3 26 30 35 32
The above items are to be packed in bins of size 50.
a Calculate the lower bound for the number of bins.
b Pack the items into the bins using:
i the first-fit algorithm ii the first-fit decreasing algorithm iii the full-bin algorithm
2 Laura hosts an internet music channel and wishes to play the 13 pieces of music listed below.
Each day, she hosts a session which is at most 3 hours long.
Piece of music A B C D E F G H I J K L M
Length (minutes) 30 30 30 45 45 60 60 60 60 75 90 120 120
a Apply the first-fit algorithm, in the order A to M, to determine the number of days that need
to be used. State which music is played on each day.
b Repeat part a using the first-fit decreasing algorithm.
c Is your answer to part b optimal? Give a reason for your answer.
Laura finds that her session time is now reduced to only 2 hours.
d Use the full-bin algorithm to determine the number of days she needs to use. State which
music is played on each day.
E 3 A small ferry loads vehicles into 30 m lanes. The vehicles are loaded bumper to bumper.
Vehicle Length (m) Vehicle Length (m)
A car 4 m F car 4 m
B car and trailer 7 m G lorry 12 m
C lorry 13 m H lorry 14 m
D van 6 m I van 6 m
E lorry 13 m J lorry 11 m
a Describe one difference between the first-fit and full-bin methods of bin packing. (1 mark)
b Use the first-fit algorithm to determine the number of lanes needed to load all the
vehicles onto the ferry. (4 marks)
c Use a full-bin method to obtain an optimal solution using the minimum number of lanes.
Explain why your solution is optimal. (4 marks)
E 4 The ground floor of an office block is to be fully recarpeted, with specially made carpet
incorporating the firm’s logo. The carpet comes in rolls of 15 m.
The following lengths are required.
A 3 m D 4 m G 5 m J 7 m
B 3 m E 4 m H 5 m K 8 m
C 4 m F 4 m I 5 m L 8 m
22 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ In a binary search, we look at halving the size of the list each time we perform a pass.
n+1
• In a binary search, we locate the midpoint of the list using _____ . We call this the pivot.
2
Like with the quick sort, we round this up if it is not an integer.
• We compare this midpoint with the item we are trying to locate; this will help us decide which
half of the list to choose.
• Eventually we will get to one item – it will either be the item we are trying to locate, or it
will not be. In this case we can say that the item we were trying to locate is not in the list.
Here is the binary search algorithm to locate an item in a list:
n+1
1 Select the midpoint of the list using _____
and round up if necessary. This is the pivot.
2
2 a If the pivot is the item we are locating, then the search is complete.
b If the pivot is after the item we are locating, then we look in the first half of the list.
c If the pivot is before the item we are locating, then we look in the second half of the list.
3 Repeat steps 1 and 2 to each remaining list until the item is located. If the item is not found,
then it is not in the list.
ALGORITHMS CHAPTER 1 23
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Example 17
Use the binary search algorithm to try to locate these names in the list that follows.
a Robinson b Davies
1 Acharya 6 Laing
Watch
out Remember that a search can be
2 Blackstock 7 Leung
unsuccessful. You may be asked to try to locate
3 Cheung 8 Robinson
something that is not in the list. You must be
4 Coetzee 9 Saludo able to show that the item is not in the list.
5 Fowler 10 Xiao
n+1
Remember to round up if _____
a The middle name is the ( _____ = 5.5)6th name:
n+1 is not an
2
2 integer.
6 Laing
Robinson is after Laing, so the list reduces to
Since Robinson is after Laing, Robinson
1 Leung
cannot be in the first part of the list and
2 Robinson
so we consider the list after the pivot.
3 Saludo
4 Xiao
The middle name in this sublist is the Robinson is before Saludo so it cannot
be in the second list and so we consider
( 2 = 2.5) 3rd name:
+1
4_____
the list before the pivot.
3 Saludo
Robinson is before Saludo, so the list reduces to:
1 Leung
2 Robinson
The middle name in this sublist is the
1 Use the binary search algorithm to try to locate these names in the list that follows:
a Connock b Walkey c Peabody
1 Berry 5 Tapner
2 Connock 6 Walkey
3 Li 7 Wilson
4 Sully 8 Wu
2 Use the binary search algorithm to try to locate these numbers in the list that follows:
a 21 b 5
1 3 3 7 5 10 7 15 9 18 11 21
2 4 4 9 6 13 8 17 10 20 12 24
4 a
Use the quick sort algorithm to put the list below into ascending order.
1 Adam 6 Ramin 11 Oli 16 Miranda
2 Ed 7 Alex 12 Lotus 17 Matt
3 Lei 8 Emily 13 Des 18 Katie
4 Lottie 9 Felix 14 George 19 Doug
5 Saul 10 Leo 15 Jess 20 Hongmei
b Use the binary search algorithm to try to locate:
i George ii David iii Jess
Chapter review 1
E/P 2 a Use the bubble-sort algorithm to sort, in descending order, the list
25 42 31 22 26 41
giving the state of the list on each occasion when two or more
values are interchanged (swapped). (4 marks)
b Find the maximum number of interchanges needed to sort a list
of six pieces of data using the bubble-sort algorithm. (2 marks)
E 3 8 4 13 2 17 9 15
This list of numbers is to be sorted into ascending order.
Perform a quick sort to obtain the sorted list, giving the state of the list after each
rearrangement. (5 marks)
E 4 111 103 77 81 98 68 82 115 93
a The list of numbers above is to be sorted into descending order.
Perform a quick sort to obtain the sorted list, giving the state of the list
after each rearrangement and indicating the pivot elements used. (5 marks)
b i Use the first-fit decreasing bin-packing algorithm to fit the data
into bins of size 200. (3 marks)
ii Explain how you decided in which bin to place the number 77. (1 mark)
E 5 Trishna wishes to record eight television programmes. The lengths of the programmes,
in minutes, are:
75 100 52 92 30 84 42 60
Trishna decides to use 2-hour (120 minute) DVDs only to record all of these programmes.
a Explain how to apply the first-fit decreasing bin-packing algorithm. (2 marks)
b Use this algorithm to fit these programmes onto the smallest number of DVDs possible,
stating the total amount of unused space on the DVDs. (3 marks)
Trishna wants to record an additional two 25-minute programmes.
c Determine whether she can do this using only 5 DVDs, giving reasons for your answer.
(3 marks)
E 6 A DIY enthusiast requires the following 14 pieces of wood as shown in the table.
Length in metres 0.4 0.6 1 1.2 1.4 1.6
Number of pieces 3 4 3 2 1 1
The DIY store sells wood in 2 m and 2.4 m lengths. He considers buying six 2 m lengths of wood.
a Explain why he will not be able to cut all of the lengths he requires from these six
2 m lengths. (2 marks)
b He eventually decides to buy 2.4 m lengths. Use a first-fit decreasing bin-packing algorithm
to show how he could use six 2.4 m lengths to obtain the pieces he requires. (4 marks)
c Obtain a solution that requires only five 2.4 m lengths. (4 marks)
26 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Box 1 i = 1, A = u1
Temp = | 5 – u1 |
Box 2 i=i+1
Box 3 M = | 5 – ui|
Is
Box 4 M < Temp?
Yes
A = ui
Box 5 No
Temp = M
Is Yes
Box 6
i < 5?
No
Box 7 Print A
Stop
Challenge
E/P 10 A binary search is to be performed on a list of names to try to locate Kim.
1 Jenny 6 Hyo
2 Merry 7 Kim
3 Charles 8 Richard
4 Ben 9 Greg
5 Toby 10 Freya
a Explain why a binary search cannot be performed with the list in its present form.(1 mark)
b Using an appropriate algorithm, alter the list so that a binary search can be
performed, showing the state of the list after each complete iteration. State the
name of the algorithm you have used. (4 marks)
c Use the binary search algorithm to locate the name Kim in the list you obtained
in b. You must make your method clear. (4 marks)
28 CHAPTER 1 ALGORITHMS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
2 In a flow chart, the shape of each box tells you about its function.
5 In a quick sort, you select a pivot and then split the items into two sublists:
• One sublist contains items less than the pivot.
• The other sublist contains items greater than the pivot.
• You then select further pivots from within each sublist and repeat the process.
6 The three bin-packing algorithms are first-fit, first-fit decreasing, and full-bin:
• The first-fit algorithm works by considering items in the order they are given.
• The first-fit decreasing algorithm requires the items to be in descending order
before applying the algorithm.
• Full-bin packing uses inspection to select items that combine to fill bins completely.
Remaining items are packed using the first-fit algorithm.
7 The three bin-packing algorithms have the following advantages and disadvantages:
8 A binary search will search an ordered list to find out whether an item is in the list. If it is in
the list, it will locate its position in the list.
In a binary search, the pivot is the middle item of the list. If the target item is not the pivot,
the pivot and half of the list are discarded. The list length halves at each pass.
n+1
The middle of n items is found by _____
, rounding up if necessary.
2
2 GRAPHS AND
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
NETWORKS 2.1
Learning objectives
After completing this chapter you should be able to:
● Know how graphs and networks can be used to
create mathematical models → pages 30–33
● Be familiar with basic graph theory terminology → pages 34–38
● Know some special types of graph → pages 38–40
● Understand how graphs and networks can be
represented using matrices → pages 42–44
C B
a
a 50 m
b A, B, F This is an example of a weighted network.
GRAPHS AND NETWORKS CHAPTER 2 31
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
The network shows the times taken, in minutes, by a car to travel along some sections of road.
C
A
5 8
B 1
10
2
E 5 D
Calculate the minimum time needed to travel from A to D and give the route taken.
Chris
Govinda
Dhevan Esme
2 This table gives information about the subjects studied by some students.
Student Subjects
A Mathematics, Chemistry
B Mathematics, Chemistry, Biology, Art
C Physics, Chemistry, Biology
D Mathematics, Physics, Art, English
E Biology, English, Art
F English, Mathematics, Art, Physics
P 3 Here is a map of part of the London underground train system. The colours indicate the
different train lines and a circle indicates where you can change from one line to another without
leaving the underground.
GRAPHS AND NETWORKS CHAPTER 2 33
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
To go from Lancaster Gate to Hyde Park Corner, for example, you would take the red line from
Lancaster Gate to Bond Street, change onto the grey line to Green Park, and finally take the
dark blue line to Hyde Park Corner.
a Work out a possible route from Chancery Lane to Victoria:
i that requires a minimum number of changes
ii that passes through a minimum number of stations.
A student estimates that it takes 80 seconds to travel from one station to the next, and that it
takes 3 minutes to change trains at one of the junction stations.
b Work out the quickest possible journey time from:
i Marylebone to Waterloo
ii Victoria to Baker Street
iii Holborn to St James’s Park.
P 4 This weighted network shows the flight times of a particlar airline, in minutes,
between some airports in the UK and Ireland.
A
A Aberdeen
118 E
G B Belfast
45 C Cork
B 85 N
40 D Dublin
38
73 E Edinburgh
L
D G Glasgow
65 M
L Leeds-Bradford
92
55 M Manchester
C N Newcastle
a Write down the flight time between Glasgow and Manchester.
b Name the route with the longest flight time.
c Suggest which city might be the home base of this airline. Give a reason for your answer.
Challenge H G
SKILLS The diagram shows a wire network in the shape of a cube. E F
INNOVATION An ant walks from vertex A to vertex G along the cube’s edges.
Find the total number of possible different routes which: D
C
a are of minimum length
b do not pass through any vertex more than once. A B
34 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ The degree of a vertex is the number of edges that meet at that vertex. Notation
K Vertex Degree The degree
Degree 2 because 2 edges meet here.
J 2 of a vertex is
L K 2 sometimes called
the valency or
L 1
order.
J M 4
M
N
N 1
Links
A trail which traverses
■ If the degree of a vertex is even, it has even degree, so J,
K and M have even degree. Vertices L and N have odd degree. every arc and starts and ends
at the same vertex is called an
■ A walk is a route through a graph along edges from Eulerian cycle.
one vertex to the next. → Decision 1 Section 4.1
GRAPHS AND NETWORKS CHAPTER 2 35
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
R
U
W
F H V
S
U
This is a connected graph. This graph is not connected.
A path can be found between any two vertices. There is no path from R to V, for example.
■ A loop is an edge that starts and finishes at the same vertex.
A
■ A simple graph is one in which there are no loops and there is no more than one edge
connecting any pair of vertices.
multiple
edges This is not a simple graph because it
D
has two edges connecting D and E.
E
F
C
36 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ If the edges of a graph have a direction associated with them they are known as directed edges
and the graph is known as a directed graph, often abbreviated to digraph.
Q
P R
T
S
■ In any undirected graph, the sum of the degrees of the vertices Notation
A lemma is
is equal to 2 × the number of edges. As a result, the number a small theorem used as
of odd vertices must beeven, including possibly zero. a stepping stone to more
This result is knownas Euler’s handshaking lemma. important results.
Example 4 A
a Find the sum of the valencies of the vertices in this graph.
b Verify that your answer to part a is twice the number of B
edges in the graph. F C
a Vertex Valency
A 3
B 3 E D
C 3
D 3 Notice that the number of vertices of odd degree
is even (there are four of them).
E 4
If each vertex represents a person and each edge
F 2
indicates that two people have shaken hands,
Total 18 then the number of people who have shaken
b The graph has 9 edges. hands an odd number of times must be even.
Sum of valencies = 18 = 2 × 9
= 2 × number of edges
A graph has 5 nodes and 8 edges. The valencies of the nodes are x, x − 1, x + 1, 2x − 1 and x − 1.
Find the value of x.
C J
I H
B E
c P d U V
T Q
W
X
Z
S R
d draw a subgraph
e confirm the handshaking lemma.
N
5 Repeat question 4 parts c, d and e using this graph: K
Q
L P
J R
M S
P 6 Show that it is possible to draw a graph with:
a an even number of vertices of even degree
b an odd number of vertices of even degree.
c Explain why it is not possible to draw a graph with an odd number of vertices of odd degree.
38 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
4 8
S R
9 A graph has 7 nodes and 14 edges.
The valencies of the nodes are: x, x2, x + 1, 3x − 1, 2x + 1, 3x − 2, 4x − 3.
Find the value of x.
D
T
E U W
F G V
A F
C E
C E
B D
A F
C E
There are many other possible spanning trees.
■ A complete graph is a graph in which every vertex is directly connected by a single edge to each
of the other vertices.
Notation
The complete graph
with n vertices is written as K n .
K3 K4
K6
■ Isomorphic graphs are graphs which show the same information but may be drawn differently.
40 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
For two graphs to be isomorphic, they must have the same number of vertices of the same degree,
and these vertices must also be connected together in the same ways. If there is an edge between
two vertices in one graph, then there is also an edge between the two corresponding vertices in
the other graph.
and R W
T
M N P Q S X
Both graphs have the same number of vertices. Each graph has the same number of vertices of
First graph Second graph the same degree.
Vertex Degree Vertex Degree
N 4 S 4
P 3 U 3
K 2 V 2
L 2 X 2
J 1 R 1
M 1 T 1
Q 1 W 1
N can be paired with S.
P can be paired with U. Pair up the vertices, starting with N and S as they
K can be paired with V. are the only vertices which have degree 4.
L can be paired with X.
J can be paired with R. You will need to check that the pairings create
M can be paired with T. the graphs in the original question.
Q can be paired with W.
Since the pairing can be made, the two
graphs are isomorphic.
E D
F E
C D
A B
Challenge
Draw all possible connected SKILLS Hint
Not counting isomorphic graphs,
graphs with three edges. CREATIVITY there are 11 such graphs.
42 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
B
Example 8 SKILLS INTERPRETATION E
A B C D E F
D
A 0 1 0 0 0 0
Watch
out You should be able to write down
B 1 0 1 0 2 1 the adjacency matrix given a graph, and draw a
C 0 1 0 1 1 0 graph given the adjacency matrix.
D 0 0 1 0 0 1
This indicates that there are 2 direct connections
E 0 2 1 0 0 1 between B and E.
F 0 1 0 1 1 2
This indicates a loop from F to F. It could be
travelled in either direction, and hence counts as 2.
T
Example 10 SKILLS INTERPRETATION
11
8 6 V
Use a distance matrix to represent this directed network. R U
7
9
4 9
R S T U V W
R — 4 11 — — — S 10 W
S 4 — — 9 — 10 Watch
out This matrix is not symmetrical about
11 — — 8 — — the leading diagonal.
T
U — 9 8 — 6 — This indicates a direct link of weight 6 from U to V.
V — — — 7 — —
This indicates a direct link of weight 7 from V to U.
W — 10 — — 9 —
This shows a direct link of weight 9 from W to V.
D
B G
C F
A
E
c A B C D d A B C D
A 0 1 0 1 A 0 2 0 1
B 1 0 1 1 B 2 0 1 0
C 0 1 0 1 C 0 1 0 1
D 1 1 1 0 D 1 0 1 0
44 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
11 12
Chapter review 2
f g h i
18 25
A
C 20
10
16 E
23
D
c Draw a spanning tree for this network and state the weight of your spanning tree.
P 5 Write an expression for the number of edges in a spanning tree containing v vertices.
P
T
S
46 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
E B
D C
B F
C G
D H
F
C
E D (2 marks)
GRAPHS AND NETWORKS CHAPTER 2 47
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Challenge
SKILLS The diagram shows a connected graph. The regions of the graph are shaded in different colours.
INNOVATION,
CREATIVITY
Let V denote the number of vertices, E denote the number of edges, and R denote the number of regions
in a connected graph.
a For the graph above, verify that V + R – E = 1.
b Draw a graph with one vertex and four edges, and verify that V + R – E = 1.
c Explain why the relationship V + R – E = 1 holds for any graph with one vertex.
A contraction of an edge in a graph glues together adjacent vertices, creating a graph with one less vertex.
This diagram shows the above graph with one edge contracted.
d Given that G is a connected graph, and that G’ is the graph formed by contracting one edge of G, show
that if the relationship
V + R – E = 1 holds for G’, then it must hold for G.
e Using your results from parts c and d, show that the relationship
V + R – E = 1 holds for all connected graphs.
2 If a graph has a number associated with each edge (usually called its weight), then the graph is
known as a weighted graph or network.
3 A subgraph is a graph, each of whose vertices belongs to the original graph and each of whose
edges belongs to the original graph. It is part of the original graph.
4 The degree (or valency or order) of a vertex is the number of edges that meet at that vertex.
5 If the degree of a vertex is even, you say that it has even degree. If the degree of a vertex is
odd it has odd degree.
48 CHAPTER 2 GRAPHS AND NETWORKS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
6 A walk is a route through a graph along edges from one vertex to the next.
9 A cycle is a walk in which the end vertex is the same as the start vertex and no other vertex
is visited more than once.
11 Two vertices are connected if there is a path between them. A graph is connected if all its
vertices are connected.
13 A simple graph is one in which there are no loops and there is at most one edge connecting
any pair of vertices.
14 If the edges of a graph have a direction associated with them they are known as directed
edges and the graph is known as a directed graph (or digraph).
15 In any undirected graph, the sum of the degrees of the vertices is equal to 2 × the number
of edges. As a consequence, the number of odd nodes must be even. This result is called
Euler's handshaking lemma.
17 A spanning tree of a graph is a subgraph which includes all the vertices of the original graph
and is also a tree.
18 A complete graph is a graph in which every vertex is directly connected by a single edge
to each of the other vertices.
19 Isomorphic graphs are graphs which show the same information but may be drawn differently.
20 Each entry in an adjacency matrix describes the number of arcs joining the corresponding
vertices.
21 In a distance matrix, the entries represent the weight of each arc, not the number of arcs.
ALGORITHMS ON GRAPHS CHAPTER 3 49
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
3 ALGORITHMS
ON GRAPHS
Learning objectives
2.1
2.2
Learning objectives
After completing this chapter you should be able to:
● Use Kruskal’s algorithm to find a minimum spanning tree → pages 50–54
● Use Prim’s algorithm on a network to find a minimum
spanning tree → pages 54–56
● Apply Prim’s algorithm to a distance matrix → pages 57–60
● Apply the nearest neighbour algorithm to find a
short path → pages 60–63
● Use Dijkstra’s algorithm to find the shortest path
between two vertices in a network → pages 64–71
Use Kruskal’s algorithm to find a minimum spanning tree for this network. List the arcs in the
order that you consider them. State the weight of your tree.
D
4 8 In a network of n vertices, a spanning tree will
E 6 C always have (n − 1) arcs. In this case there will be 4
6
5 arcs in the spanning tree.
5
B
7
A
By inspection, the order of the arcs is AE and BC could have been written in either
DE(4), AE(5), BC(5), AD(6), order, as both have weight 5. Likewise, AD and
BD(6), AB(7), CD(8). BD could have been written in either order.
Start with DE.
D
4 8
E C
6 6 Online
Explore
7 Kruskal's algorithm
5
B using GeoGebra.
7
A
Add AE.
D
4 8 You do not need to draw each of these diagrams.
E C The list of arcs, in order, with your decision about
6 6
5 rejecting or adding them, is sufficient to make
5 your method clear.
B
7
A
ALGORITHMS ON GRAPHS CHAPTER 3 51
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
By inspection, the order of the arcs is Remember that you can choose AD and BC in
AD(8), BC(8), AC(10), CD(10), EF(11), CE(12), either order, AC and CD in either order, and CE
DE(12), DF(13), BE(14). and DE in either order.
Start with AD. 8 D
A
C You may find it helpful to draw out the tree as
you go. It makes it easier to check for cycles.
F
B E
Add BC. 8
A D Watch out
You need to consider all the arcs in
C
turn, even when they have equal weight. If you
8 F start with AD then you have to consider BC next.
B E
52 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Add AC. 8
A D
10 C
8 F
B E
8 D
Add CE. A
10 C
8 F
12 11
B E
One solution is:
8 D
A The minimum spanning tree that you create
10 C will depend on how you choose the arcs. Each
8 F one is a solution because they will all have the
12 11 least weight.
B E (using AC and CE)
The other three solutions are:
8 D
A
10 C
12
8 F
11
B E (using AC and DE)
8 D
A
C 10
8 F
12 11
B E (using CD and CE)
A 8 D
C 10 12
8 F
11
B E (using CD and DE)
The weight of each tree is All four solutions are minimum spanning trees,
8 + 8 + 10 + 11 + 12 = 49 so they will all have the same total weight.
ALGORITHMS ON GRAPHS CHAPTER 3 53
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 Use Kruskal’s algorithm to find minimum spanning trees for each of these networks.
State the weight of each tree. You must list the arcs in the order in which you consider them.
a A 25 B b A 7 C
4 B 7
14 16 C 18 6
17 12
5 4 2 5 D
H 20 12 D E
21 7
15
11 3 F 8
18
G 6 E
G 24 F
c A 3.8 B
C
4.2 2.1
4.1
4.3 D
2.2 E
H 1.4
4.1 3.8 1.7 2.1
2.3
J 3.1 G 3.2 F
E 4 The diagram shows nine villages and the distances between them in kilometres.
A cable TV company plans to link up the villages.
Claver
0.8 1.4
Morris Salis 2.8 Cedars
1.7 1.9
2.3 1.6 Haversham
3.3 2.9
2.8 2.8 2.1
Ritchie
1.1
Plumptree 3.1 Edwards Shrewsbury
a Find a minimum spanning tree for the network using Kruskal’s algorithm. List the arcs
in the order that they were added to the tree. (4 marks)
b Use your answer to part a to find the minimum length of cable required to link all the
villages together. (1 mark)
B 15
F Online
Explore Prim's algorithm using
10 9 GeoGebra.
8
12 A
C 12
Watch
out In your exam, you may be asked to
9 11
8 use Prim’s or Kruskal’s algorithm. You must know
E which is which.
D 14
Use Prim’s algorithm to find a minimum spanning tree for the network above.
List the arcs in the order in which you add them to your tree.
ALGORITHMS ON GRAPHS CHAPTER 3 55
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
E
D Now consider arcs that link either A or F to a
Add AD to the tree. vertex not in the tree: AB(9), AD(9), AE(11),
B AC(12), FE(12) and FB(15).
F
8
A
C Add the arc of least weight, from A or F, that
introduces a new vertex to the tree. In this case
9 there are two arcs of least weight, AD and AB.
E You can choose either. In this case, AD is chosen.
D
Add DC to the tree.
B F
8 The arcs linking A, F and D to the remaining
A vertices are AB(9), AE(11), AC(12), FE(12), FB(15),
C
DC(8), DE(14). The one of least weight is DC.
8 9
E
D
1 Repeat Question 1 in Exercise 3A using Prim’s algorithm. Start at vertex A each time.
E/P 4 Q 38 T 27 W
27 35 15 41
18 29
31 S 33 V
P 19 Y
29
33 24 34 28 48
R 37 U 29 X
The network shows ten villages and the costs, in thousands of dollars, of connecting them with
a new energy supply.
a Use Prim’s algorithm, starting at P, to find the energy supply network
that would connect all ten villages for minimum cost. (3 marks)
b Draw your minimum connector and state its cost. (2 marks)
c Unforeseen problems with the link between villages W and X mean that the cost of connecting
them rises to $34 000. Explain how this affects your minimum spanning tree. (2 marks)
E/P 5 a Explain why it is not necessary to check for cycles when using Prim’s algorithm. (1 mark)
B
SKILLS 21
D J
4 24
REASONING/
ARGUMENTATION 8 F 17
A 10 10 9
8
8
12 9 K
8 I
C
19
7
11 G
E 16
8 L
6
H
b Use Prim’s algorithm, starting at A, to find a minimum spanning tree for this network.
You must make your order of arc selection clear. (3 marks)
c State, with a reason, whether this minimum spanning tree is unique. (2 marks)
ALGORITHMS ON GRAPHS CHAPTER 3 57
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1
↓
A B C D E
A – 27 12 23 74 Delete row A, and number column A.
B 27 – 47 15 71
C 12 47 – 28 87
D 23 15 28 – 75
E 74 71 87 75 –
1
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71 The lowest undeleted entry in column A is 12,
C 12 47 – 28 87 so circle it. The first arc is AC.
D 23 15 28 – 75
E 74 71 87 75 –
The first arc is AC.
58 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 2
↓ ↓
A B C D E The new vertex is C. Delete row C, and number
A – 27 12 23 74 column C.
B 27 – 47 15 71
C 12 47 – 28 87 The lowest undeleted entry in columns A and C
D 23 15 28 – 75 is 23, circle it. The second arc is AD.
E 74 71 87 75 –
The second arc is AD.
1 2 3
↓ ↓ ↓ The new vertex is D. Delete row D, and number
A B C D E column D.
A – 27 12 23 74
B 27 – 47 15 71 The lowest undeleted entry in columns A, C and
C 12 47 – 28 87 D is 15. Circle it. The third arc is DB.
D 23 15 28 – 75
E 74 71 87 75 –
The third arc is DB.
1 4 2 3
↓ ↓ ↓ ↓
A B C D E
A – 27 12 23 74
The new vertex is B. Delete row B, and number
B 27 – 47 15 71
column B.
C 12 47 – 28 87
D 23 15 28 – 75 The lowest undeleted entry in columns A, C, D and
E 74 71 87 75 – B is 71. Circle it. The fourth arc is BE.
The fourth arc is BE.
1 4 2 3 5
↓ ↓ ↓ ↓ ↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71
C 12 47 – 28 87
D 23 15 28 – 75
The new vertex is E. Delete row E and number
E 74 71 87 75 –
column E.
The minimum spanning tree is:
A B All rows have now been deleted, so the algorithm
23 15
12 71 is complete.
D
C
E Watch
out You do not need to show all of these
Its weight is 12 + 23 + 15 + 71 = 121 tables. The final annotated table, plus a list of arcs
The arcs added were AC, AD, BD, BE. in order, is sufficient to make your method clear.
ALGORITHMS ON GRAPHS CHAPTER 3 59
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 Apply Prim’s algorithm to the distance matrices below. List the arcs in order of selection
and state the weight of your minimum spanning tree.
a A B C D E F b R S T U V
A – 15 20 34 25 9 R – 28 30 31 41
B 15 – 36 38 28 14 S 28 – 16 19 43
C 20 36 – 43 38 22 T 30 16 – 22 41
D 34 38 43 – 26 40 U 31 19 22 – 37
E 25 28 38 26 – 31 V 41 43 41 37 –
F 9 14 22 40 31 –
2 The table shows the distance, in kilometres, between five cities. It is desired to link these
five cities by a transit system.
E/P 3 The matrix shows the costs, in euros per 1000 words, of translating appliance
instruction manuals between eight languages.
A B C D E F G H
A – 84 53 35 – 47 – 42
B 84 – 71 113 142 61 75 –
C 53 71 – – – – 59 –
D 35 113 – – 58 67 151 –
E – 142 – 58 – 168 159 48
F 47 61 – 67 168 – – 73
G – 75 59 151 159 – – 52
H 42 – – – 48 73 52 –
a Use Prim’s algorithm, starting from language D, to find the cost of translating
an instruction manual of 3000 words from D into the seven other languages. (4 marks)
60 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
E/P 4 The table shows the distances, in kilometres, between nine oil rigs and the depot X.
Pipes are to be laid to connect the rigs and the depot.
X A B C D E F G H I
X – 65 80 89 74 26 71 41 41 74
A 65 – 27 41 22 37 20 29 25 43
B 80 27 – 30 24 55 16 46 40 42
C 89 41 30 – 50 84 24 70 49 26
D 74 22 24 50 – 51 35 34 47 63
E 26 37 55 84 51 – 52 18 23 68
F 71 20 16 24 35 52 – 45 31 27
G 41 29 46 70 34 18 45 – 25 64
H 41 25 40 49 47 23 31 25 – 44
I 74 43 42 26 63 68 27 64 44 –
a Use Prim’s algorithm, starting at X, to find a minimum spanning tree for
the network. You must make the order of arc selection clear. (3 marks)
b X must now be directly connected to D and to F. Based on this condition,
use Prim’s algorithm, starting at A, to find a minimum spanning tree.
You must make the order of arc selection clear. (2 marks)
c The oil company now requires that the depot must be directly connected to oil rig D.
Find a minimum spanning tree that must meet this condition. (3 marks)
1
↓
A B C D E
A – 27 12 23 74 Delete row A, and number column A.
B 27 – 47 15 71
C 12 47 – 28 87
D 23 15 28 – 75
E 74 71 87 75 –
1
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71 The lowest undeleted entry in column A only is 12,
C 12 47 – 28 87 so circle it. The first arc is AC.
D 23 15 28 – 75
E 74 71 87 75 –
1 2
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71
The new vertex is C. Delete row C, and number
C 12 47 – 28 87
column C.
D 23 15 28 – 75
E 74 71 87 75 –
1 2
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71
C 12 47 – 28 87
The lowest undeleted entry in column C only is
D 23 15 28 – 75 28, so circle it. The second arc is CD.
E 74 71 87 75 –
62 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 2 3
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71
C 12 47 – 28 87
The new vertex is D. Delete row D, and number
D 23 15 28 – 75
column D.
E 74 71 87 75 –
1 2 3
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71 The lowest undeleted entry in column D is 15, so
circle it. The third arc is DB.
C 12 47 – 28 87
D 23 15 28 – 75
E 74 71 87 75 –
1 4 2 3
↓
A B C D E
A – 27 12 23 74
15 The new vertex is B. Delete row B, and number
B 27 – 47 71
column B.
C 12 47 – 28 87
D 23 15 28 – 75
E 74 71 87 75 –
1 4 2 3
↓
A B C D E
A – 27 12 23 74
B 27 – 47 15 71
C 12 47 – 28 87
D 23 15 28 – 75 The lowest undeleted entry in column B only is 71,
E 74 71 87 75 – so circle it. The fourth arc is BE.
1 4 2 3 5
↓
A B C D E
A – 27 12 23 74
The new vertex is E. Delete row E and number
B 27 – 47 15 71
column E.
C 12 47 – 28 87
D 23 15 28 – 75 All rows have now been deleted, so the algorithm
E 74 71 87 75 – is complete.
1 Apply the nearest neighbour algorithm to find a short path connecting all vertices for
the following matrices:
a Start at A b Start at S
A B C D E F R S T U V
A – 15 20 34 25 9 R – 28 30 31 41
B 15 – 36 38 28 14 S 28 – 16 19 43
C 20 36 – 43 38 22 T 30 16 – 22 41
D 34 38 43 – 26 40 U 31 19 22 – 37
E 25 28 38 26 – 31 V 41 43 41 37 –
F 9 14 22 40 31 –
2 After applying the nearest neighbour algorithm, adding an arc back to the start vertex will create
a route. By applying the nearest neighbour algorithm, starting at each vertex in turn,
find a shortest route and state its length.
A B C D E F
A – 20 30 32 12 15
B 20 – 10 25 32 16
C 30 10 – 15 35 19
D 32 25 15 – 20 34
E 12 32 35 20 – 16
F 15 16 19 34 16 –
3 By applying the nearest neighbour algorithm, starting at each vertex in turn, find a shortest
route and state its length.
A B C D E
A – 153 98 124 115
B 153 – 74 131 149
C 98 74 – 82 103
D 124 131 82 – 134
E 115 149 103 134 –
64 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 Label the start vertex, S, with the final label, 0. The algorithm makes
use of labels. Start
2 Record a working value at every vertex, Y, that is directly
at the initial vertex
connected to the vertex, that has just received its final label, X.
and move through
• Working value at Y = final label at X + weight of arc XY the network, putting
• If there is already a working value at Y, it is only replaced if working values on
the new value is smaller. each vertex.
• Once a vertex has a final label, it is not revisited and its Each pass finds the
working values are no longer considered. shortest route to one of
the vertices and records
3 Look at the working values at all vertices without final labels.
its final label (also
Select the smallest working value. This now becomes the final
called its permanent
label at that vertex. (If two vertices have the same smallest label). Once a vertex
working value, either may be given its final label first.) has its final label it is
4 Repeat steps 2 and 3 until the destination vertex, T, receives its ‘fixed’ and its working
final label. values are no longer
5 To find the shortest path, trace back from T to S. If B already considered. Continue
in this way until the
lies on the route, include arc AB whenever:
destination vertex
final label of B − final label of A = weight of arc AB
is reached.
Online
Explore Dijkstra's
algorithm using GeoGebra.
Use Dijkstra’s algorithm to find the shortest route from S to T in the network below.
A
4 Notation
To make the working clear, you
5 D
4 3 replace the vertices with boxes like this:
6 B 8
S T Vertex Order of labelling Final label
2 Working values
2 12
C
ALGORITHMS ON GRAPHS CHAPTER 3 65
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
C 12
C 12
2
A
5 4
5 D
4
S 1 0 6 B 3
6 8
T Look at the working values at A, B
2 2
and C. The smallest is 2 (at C). This
C 2 2 12 will become the next final label. C is
2 now completed. It is the 2nd vertex
to be completed.
A
5 4
5 D Add working values to each vertex
that is directly connected to C.
4
S 1 0 6 B Note that the algorithm has picked
3
up the shortcut to B. S → B has
6 4 8
weight 6, but S → C → B has total
T
2 2 weight 4.
14
C 2 2 12
2
66 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
A
5 4
5 D The smallest working value is 4 at B.
4 8 This becomes the final label at B.
S 1 0 6 B 3 4 3 B becomes the 3rd completed vertex.
6 4 8 Add working values to D and T
T because these are directly connected
2 2 to B.
14 12
C 2 2 12
2
The smallest working value is 5 at
A 4 5 A. A becomes the 4th vertex to be
5 4 completed. It has a final value of 5.
5 D
4 8 The only working value to add would
S 1 0 6 B 3 4 3 be a 9 at D. However this is larger
6 4 8 than the 8 already there, so it does
T
not need to be recorded.
2 2
14 12
C 2 2 12
2
A 4 5
5 4
5 D 5 8 The final diagram looks like this.
4 8
S 1 0 6 B 3 4 3 Hint
You do not need to draw lots
6 4 8
of diagrams to show your working.
T 6 11 Working through just one diagram
2 2
14 12 11 and completing all the boxes will
C 2 2 12 make the method clear.
2 → Example 7
ALGORITHMS ON GRAPHS CHAPTER 3 67
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ You can use Dijkstra’s algorithm to find the shortest route between the start vertex and any
other vertex with a final label.
C 12 F
A 1 0 18 D 4 15 9 G 7 24 8 H 8 29
18 16 15 24 29
8 8 6
9
C 2 8 F 5 20 Check that your method
8 12 20 can be followed clearly.
68 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
■ It is possible to use Dijkstra’s algorithm on networks with directed arcs. This is like trying to find
a driving route where some of the roads are one-way streets.
The network below represents part of a road system in a city. Some roads are one-way and these
are indicated by directed arcs. The number on each arc represents the time, in minutes, to travel
along that arc.
a Show that there are two quickest routes B 4 D 11 G
from A to I. Explain how you found
9 2
your routes from your labelled diagram. 2 3 1
C F 5
Road HI is closed due to roadworks. 5 1 H
2 7 2
b Find the quickest route from A to I, 5 8
avoiding HI.
A 5 E 14 I
Hint
Examiners check the order in which the Problem-solving
numbers appear in the list of working values. Notice that 5 does not appear as a working value
It is important to put them in the order given for vertex E since it is not possible to travel
by the algorithm. directly from A to E.
ALGORITHMS ON GRAPHS CHAPTER 3 69
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
1 Use Dijkstra’s algorithm to find the shortest route from S to T in each of the following networks.
In each case, explain how you determined the shortest path from your fully labelled diagram.
a C 3 F b A 2 C 10 T
10
A
1 2 6 4 8
5 4 5 2
7 5
6 G 8 D 2 F 2
16 T S 1 H
D
S 2 4
6 1 3 6
8 10 9 5
6
E 4 H B 3 E 5 G
3
B
A B C
P 2 The network shows part of a road system in 17 5
a city. The number on each arc gives the time, 24 20 17 14
16 8 16
in minutes, it takes to travel along that arc. F
8 E 6 4 G 9
Use Dijkstra’s algorithm to find: D H
a the quickest route from A to Q 9
3
17
18
8 14 8 5 3
and its length 8 J 11 K 15 L 2
I M
b the quickest route from A to L
and its length 13 27
22 16 22 29
4
c the quickest route from M to A and its length
d the quickest route from P to A and its length. N 3 P 13 Q
70 CHAPTER 3 ALGORITHMS ON GRAPHS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
SKILLS
metres, of all the roads in a building site.
331 275
CREATIVITY
A bulldozer is needed for one day at T. E 291
379 G
There are two bulldozers available on-site, C
S1
one at S1, and the other at S2. 890 438
207 118
One of the two bulldozers will be moved to T. 784
T
In order to minimise the cost it is decided
852
to move the bulldozer that is closest to T. S2 642 F
219
Use Dijkstra’s algorithm to determine which 293 D
309
bulldozer should be moved. A
(7 marks)
Problem-solving
It is possible to solve this problem with only one
application of Dijkstra’s algorithm. Think carefully
about the starting point.
D
ALGORITHMS ON GRAPHS CHAPTER 3 71
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
b Given that paths TQ and RP already exist, and so must form part of the tree, state which
algorithm, Prim’s or Kruskal’s, you would select to complete the spanning tree.
Give a reason for your answer. (2 marks)
E 4 It is intended to network five computers at a large race track. There is one computer at
the office and one at each of the four different entrances. Cables need to be laid to link the
computers. Cable laying is expensive, so a minimum total length of cable is required.
The table shows the shortest distances, in metres, between the various sites.
Office Entrance 1 Entrance 2 Entrance 3 Entrance 4
Office – 1514 488 980 945
Entrance 1 1514 – 1724 2446 2125
Entrance 2 488 1724 – 884 587
Entrance 3 980 2446 884 – 523
Entrance 4 945 2125 587 523 –
a Starting at Entrance 2, demonstrate the use of Prim’s algorithm and hence find a minimum
spanning tree. You must make your method clear, indicating the order in which you selected
the arcs in your final tree. (4 marks)
b Calculate the minimum total length of cable required. (2 marks)
E/P 5 A
29 B 19 C
9
30 27 26
E 8 F 17 D
H 18
22 24 12 20
14 14
26 G
J I
K
The diagram above shows a weighted network. The weights of each arc are given in the
following table:
AB AE AH BC CD CF CG DG EF EJ EK FI FJ GI HK JK
29 27 30 19 9 26 17 18 8 12 24 20 14 14 22 26
a Use a quick sort to write these arcs in order of weight, smallest first. (4 marks)
ALGORITHMS ON GRAPHS CHAPTER 3 73
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
b Use Kruskal’s algorithm to find a minimum spanning tree for this network. (3 marks)
c Draw your minimum spanning tree and state its total weight. (2 marks)
For any connected network,
e = number of edges in the minimum spanning tree
v = number of vertices in the network.
d Write down the relationship between e and v. (2 marks)
SKILLS
to buildings on a large industrial 7
CREATIVITY
estate. The lines are to be laid 1 L
2 3 3
by the side of the roads on the 5 4
estate. The estate is shown here 2 5 6
A N
as a network. The buildings are D G I 6
designated A, B, C, ..., N and the 6
5
4 4 4
distances between them are given M
in hundreds of metres. The manager 3
wants to minimise the total length of B 5 E 7 J 3 K
power line to be used.
a Use Kruskal’s algorithm to obtain a minimum spanning tree for the network
and hence determine the minimum length of power line needed. (4 marks)
Owing to a change of circumstances, the company modifies its plans for the estate.
The result is that the road from F to G now has a length of 700 metres.
b Determine the new minimum total length of power line. (3 marks)
E 21 D
10 The table below shows the flight distances, in kilometres, between eight cities: Alice Springs (A),
Brisbane (B), Cairns (C), Darwin (D), Eden (E), Freemantle (F), Gladstone (G) and Hobart (H).
Both Prim’s algorithm and the nearest neighbour algorithm connect all of the cities together.
A B C D E F G H
A – 1970 1450 1290 2130 2010 1770 2470
B 1970 – 1390 2850 1110 3620 440 1790
C 1450 1390 – 1680 2280 3460 960 2890
D 1290 2850 1680 – 3330 2670 2500 3740
E 2130 1110 2280 3330 – 3160 1480 680
F 2010 3620 3460 2670 3160 – 3590 3020
G 1770 440 960 2500 1480 3590 – 2150
H 2470 1790 2890 3740 680 3020 2150 –
a Starting at A, use Prim’s algorithm to find a minimum spanning tree and state the weight of
the minimum spanning tree.
b Starting at C, use the nearest neighbour algorithm to find a short path and state its weight.
A news reporter wishes to visit all eight cities, starting from C. One way of visiting all eight
cities is to create a minimum spanning tree, then starting at C, traverse each arc twice. Another
way of visiting all eight cities is to use the nearest neighbour algorithm and, once completed, to
return directly to C.
c Using your answers to part a and b which method would give the shortest way of visiting all
eight cities.
ALGORITHMS ON GRAPHS CHAPTER 3 75
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
6 Dijkstra’s algorithm finds the shortest route between the start vertex and each intermediate
vertex completed on the way to the destination vertex.
7 It is possible to use Dijkstra’s algorithm on networks with directed arcs, such as a route with
one-way streets.
GLOSSARY 205
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
GLOSSARY
activity network (or arc network) activities decision variables (in a linear programming
represented by arcs, the completion of which, known problem) the numbers of each of the things that
as events, are shown as nodes. can be varied. The variables, which are often called
adjacency matrix each entry in an adjacency x, y, z, etc., will be the ‘letters’ in the inequalities and
matrix describes the number of arcs joining the objective function.
corresponding vertices. degree (or valency; of a vertex) the number of
algorithm a finite (i.e. limited) sequence of step-by- edges incident to the vertex, i.e. sharing a vertex.
step instructions carried out to solve a problem dependency when one activity cannot proceed until
arc a line segment connecting two nodes, also called another activity is completed.
an edge. digraph if the edges of a graph have a direction
backward pass in critical path analysis, this is associated with them, they are known as ‘directed
calculating all of the late event times. edges’ and the graph is known as a digraph.
bin-packing, first-fit an algorithm where each Dijkstra’s algorithm an algorithm to find the
object is fitted into the first available bin. shortest path from a vertex to the source vertex.
bin-packing, first-fit decreasing an algorithm distance matrix the entries in a distance matrix
where objects from a decreasing ordered list is fitted represent the weight of each arc, not the number
into the first available bin. of arcs.
bin-packing, full an algorithm where full bin dummy activity used to show dependencies
combinations are found first. between other activities.
bound a value which a set of numbers cannot go duration the length of time taken or needed to
above (upper bound) or go below (lower bound). complete an activity.
bubble sort an algorithm that orders a list of objects. early event time the earliest time of arrival at the
event allowing for the completion of all preceding
classical travelling salesman problem a problem in
activities.
which each vertex must be visited exactly once in the
shortest possible route. edge a line segment connecting two nodes, also
called an arc.
complete graph a graph in which each of the n
vertices is connected to every other vertex. edge set the set of all edges in a graph.
connected two vertices are connected if there is a Eulerian cycle (or Eulerian circuit) a trail which
path between them. A graph is connected if all its visits every arc, starting and ending at the same
vertices are linked in this way. vertex.
constraints things that will prevent you making or Eulerian graph a graph or network that contains a
using an infinite (i.e. unlimited) number of each of trail that includes every edge and starts and finishes
the variables. Each constraint will give rise to one at the same vertex.
inequality. event the start of finish of an activity.
corresponding an equivalent; connected with what feasible region the region of a graph that satisfies
you have just mentioned. all the constraints of a linear programming problem.
critical activity used to describe an activity if any feasible solution when you have found values for
increase in its duration results in a corresponding the decision variables that satisfy each constraint.
increase in the duration of the whole project. finite a value that is limited, not infinite.
critical path a path from the source node to the sink flow chart a type of diagram that represents an
node made up of critical activities. algorithm by showing the steps in boxes, and their
cycle (or circuit) a closed path, i.e. where the order by connecting the boxes with directional arrows.
end vertex of the last edge is the start vertex of formulate to develop a set of rules, expressing your
the first edge. ideas carefully.
206 GLOSSARY
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
forward pass calculating all of the early event time optimal solution a feasible solution that meets the
in critical path analysis. objective. There might be more than one optimal
Gantt (cascade) chart a graphic representation of solution.
the range of possible start and finish times for all the pass a single application of an algorithm, such as the
activities on a single diagram. bubble sort, where there is a repetition of the steps.
graph a graph G consists of points (vertices or nodes) path a finite sequence of edges, such that the end
which are connected by lines (edges or arcs). vertex of one edge in the sequence is the start vertex
Hamiltonian cycle a cycle that includes every vertex. of the next, and in which no vertex appears more
than once.
incident two objects that touch each other are
incident. pivot an object in a list or matrix which is selected by
an algorithm.
infinite a value that is unlimited, not finite.
practical travelling salesman problem a problem
inspection to use your knowledge in mathematics to
in which each vertex must be visited at least once
know the solution just by looking at it.
before returning to the start.
integer a whole number. The symbol for an integer
precede to happen or exist before something else
is z.
precedence table (or dependence table) a table
isomorphic graph a graph which shows the same
which shows which activities must be completed
information as a complete graph but may be drawn
before others are started.
differently.
Prim’s algorithm an algorithm to find a minimum
Kruskal’s algorithm an algorithm to find a minimum
spanning tree.
spanning tree.
quick sort an algorithm that orders a list of objects.
late event time the latest time that an event can be
left until without extending the time needed for the residual minimum spanning tree found when
project. a vertex is removed from the lower bound in the
travelling salesman problem.
lemma a small theorem used as a stepping stone to
more important results. route inspection algorithm an algorithm to find the
shortest route in a network
linear programming a method of solving problems
in involving inequalities and more than one variable. satisfy when having many inequalities or conditions,
and they are all true, we say that we have satisfied
loop an edge that starts and finishes at the same
them.
vertex.
scheduling a connected graph where there is one
matrix a rectangular array of numbers or other
pair of odd vertices.
mathematical functions for which operations such as
addition and multiplication are defined. semi-Eulerian graph a connected graph where there
is one pair of odd vertices.
maximise to increase something as much as possible.
shortcuts used to reduce the upper bound in the
minimise to reduce something to the smallest
travelling salesman problem.
possible amount.
simple graph a graph in which there are no loops
minimum connector see minimum spanning tree.
and there is no more than one edge connecting a pair
minimum spanning tree (also minimum of vertices.
connector) a spanning tree such that the total
sink node in critical path analysis, the final node.
length of its arcs is as small as possible.
source node in critical path analysis, the first node.
nearest neighbour algorithm an algorithm used to
find a short (but not necessarily the minimum) path spanning tree (of a graph G) a subgraph which
in a network. includes all the vertices of G and is also a tree.
node (also vertex) a point on a graph. subgraph (of G) a graph, each of whose vertices
belongs to G and each of whose edges belongs to G.
non-Eulerian graph a connected graph where there
is more than one pair of odd nodes. It is a graph table of least distances a table showing the
which is neither Eulerian or semi-Eulerian. shortest path between any two points in the network.
GLOSSARY 207
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
total float (of an activity) the amount of time tree a connected graph with no cycles.
that its start may be delayed without affecting the triangle inequality for three vertices A, B and C,
duration of the project. the triangular inequality is ‘length AB < length AC +
tour a walk which visits every vertex, returning to its length CB’, where AB is a longest length.
starting vertex. valency (or degree; of a vertex) the number of
trace table used to record the values of each variable edges incident to the vertex, i.e. sharing a vertex.
as an algorithm is run. vertex (also node) a point on a graph.
trail a walk in which no edge is visited more than vertex set the list of all vertices in a graph.
once.
walk (in a network) a finite (limited) sequence of
travelling salesman problem (also see classical edges such that the end vertex of one edge is the
and practical) a problem where one must find a start vertex of the next.
route minimum length which visits every vertex in an
weight the sum of the arcs in a graph.
undirected network.
weighted graph a graph which has a number
traverse to travel down an arc.
associated with each edge (usually called its weight).
208 ANSWERS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
ANSWERS
CHAPTER 1 ii
2 a 1 __ 9
a = __ __ c = __
4
a = 9, b = 4, c = 4, d = 3 1 4275 50
b 4 d 3
2 e = ad = 9 × 3 = 27 2 85.500
3 f = bc = 4 × 4 = 16
3 35.5
4 __
27
16
4 67.750
b It divides the first fraction by the second fraction.
3 a 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 5 67.75
b The first 10 square numbers. 6→2 63.100
4 a i
3 4.65
Step A r C r − C s Print r
4 65.425
1 253 12
5 65.425
2 21.083
6→2 65.342
3 9.083
3 0.083
4 16.542
4 65.384
5 16.542
5 65.384
6→2 15.294
6→2 65.383
3 1.248
3→7 0.001
4 15.918
5 15.918 7 Print 65.384
3 0.024
Exercise 1B
4 15.906 1 a a b c d d , 0? d=0 x
5 15.906
4 −12 9 0 No Yes 1.5
6→2 15.906
Equal roots are 1.5
3→7 0 b a b c d d , 0? d = 0? x1 x2
7 r = 15.906
−6 13 5 289 No No − _1
3
_
5
2
8 Stop
Roots are − _13 and _ 52
Online
Worked solutions are available in SolutionBank.
ANSWERS 209
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
c 2 Ch St Br Bu Cr Ev Yo
a b c d d,0
Ch Br Bu Cr Ev St Yo
3 −8 11 −68 Yes Br Bu Ch Cr Ev St Yo
Br Bu Ch Cr Ev St Yo
No real roots
Bridlington, Burton, Chester, Cranleigh, Evesham,
2 a i Output is 21 ii Output is 5 Stafford, York
b It will find the largest number in the list.
3 a 1
c Box 6 − changed to ‘Is n , 8?’
b One pass is sufficient if the items are already in
3 a 1.8041 (4 d.p.)
ascending order.
b 1.8041 (4 d.p.)
c n
The sequence produced in part b is initially quite d n passes are needed if the smallest item is at the
different to the sequence produced in part a but end of the list.
both sequences converge to the same root.
4 a i 13 ii 17 iii 15 4 a Move through the list comparing each pair of
b The algorithm finds the highest common factor of numbers. If the first number of a pair is greater
the two input values. than or equal to the second, make no change.
If the first number of a pair is less than the second,
5 a A B A , B? Output swap them.
18 7 No b 63 57 55 48 48 72 49 61 39 32
63 57 55 48 72 49 61 48 39 32
11 7 No 63 57 55 72 49 61 48 48 39 32
4 7 Yes 4 63 57 72 55 61 49 48 48 39 32
63 72 57 61 55 49 48 48 39 32
b Calculates remainder when A is divided by B. 72 63 61 57 55 49 48 48 39 32
c 0 72 63 61 57 55 49 48 48 39 32
Exercise 1C Exercise 1D
1 i a 16 15 23 18 25 11 19 34 1 a 2 3 4 5 6 7 8
15 16 18 23 11 19 25 34 b 8 7 6 5 4 3 2
15 16 18 11 19 23 25 34 2 a 7 11 14 17 18 20 22 25 29 30
15 16 11 18 19 23 25 34 b 30 29 25 22 20 18 17 14 11 7
15 11 16 18 19 23 25 34 3 a C E H J K L M N P R S
11 15 16 18 19 23 25 34 b C E H J K L M N P R S
11 15 16 18 19 23 25 34 4 a Amy 93 Greg 91 Janelle 89 Sophie 77
b 23 16 34 18 25 15 19 11 Dom 77 Lucy 57 Alison 56 Annie 51
23 34 18 25 16 19 15 11 Harry 49 Josh 37 Alex 33 Sam 29
Myles 19 Hugo 9
34 23 25 18 19 16 15 11
b 93 91 89 77 77 57 56 51 49 37 33 29 19 9
34 25 23 19 18 16 15 11
n(n − 1)
34 25 23 19 18 16 15 11 5 a (n − 1) + (n − 2) + … 3 + 2 + 1 = ________
2
ii a E N T O R K S W b The bubble sort would be quicker, for example,
ENORKSTW if the items are to be put in increasing order
ENOKRSTW and if the only item out of place is the largest.
c i Bubble sort. Only the 7 is out of place and it
ENKORSTW
will be moved to its final position in the first
EKNORSTW pass. A second pass is still needed to complete
EKNORSTW the bubble sort. A total of 11 comparisons are
b N T W O R K S E needed for the bubble sort and 14 are needed for
TWORNSKE the quick sort.
WTROSNKE ii Quick sort. This is the worst case for the bubble
WTRSONKE sort. The 1 is at the wrong end of the list and
only moves one place with each pass.
WTSRONKE
6 a There are 9 names in the list. The 5th name (Mellor)
WTSRONKE
is taken as the pivot. Starting at the beginning of the
iii a A5 D2 A1 B4 C7 C2 B3 D3 list, each name is compared with Mellor and placed
A5 A1 B4 C7 C2 B3 D2 D3 on the appropriate side to produce two sublists. The
A1 A5 B4 C2 B3 C7 D2 D3 process is repeated for each sublist with pivot of G
A1 A5 B4 B3 C2 C7 D2 D3 on the left and M on the right.
A1 A5 B3 B4 C2 C7 D2 D3 b H S F G Me C Mi W A (M is the pivot)
A1 A5 B3 B4 C2 C7 D2 D3 H F G C A Me S Mi W (1st pass)
b D3 D2 A5 B4 C7 C2 B3 A1 F C A G H Me Mi S W (2nd pass)
D3 D2 B4 C7 C2 B3 A5 A1
D3 D2 C7 C2 B4 B3 A5 A1 Challenge
D3 D2 C7 C2 B4 B3 A5 A1 a Answers will vary.
b Put the Ace of Hearts at the end.
210 ANSWERS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Exercise 1E 4 a
Adam
1 a 5 bins Alex
b i Bin 1: 18 + 4 + 23 + 3 Des
Bin 2: 8 + 27 Doug
Bin 3: 19 + 26 Ed
Bin 4: 30 Emily
Bin 5: 35 Felix
Bin 6: 32 George
ii Bin 1: 35 + 8 + 4 + 3 Hongmei
Bin 2: 32 + 18 Jess
Bin 3: 30 + 19 Katie
Bin 4: 27 + 23 Lei
Leo
}
Bin 5: 26
iii Bin 1: 32 + 18 Lottie
Bin 2: 27 + 23 full bins Lotus
Bin 3: 35 + 8 + 4 + 3 Matt
Bin 4: 19 + 26 Miranda
Bin 5: 30 Oli
Ramin
2 a Bin 1: A(30) + B(30) + C(30) + D(45) + E(45)
Saul
Bin 2: F(60) + G(60) + H(60)
b i George is in the list
Bin 3: I(60) + J(75)
ii David is not in the list
Bin 4: K(90)
iii Jess is in the list
Bin 5: L(120)
Bin 6: M(120) Chapter review 1
b Bin 1: M(120) + I(60) 1 15 2 27 16 1 38
Bin 2: L(120) + H(60) 2 15 16 1 27 38
Bin 3: K(90) + J(75) 2 15 1 16 27 38
Bin 4: G(60) + F(60) + E(45) 2 1 15 16 27 38
Bin 5: D(45) + C(30) + B(30) + A(30)
1 2 15 16 27 38
c Lower bound 5 so b optimal.
d Bin 1: M(120) ⎫ 2 a 42 31 25 26 41 22
Bin 2: L(120) ⎪ 42 31 26 41 25 22
Bin 3: A(30) + K(90) ⎪
Bin 4: F(60) + G(60) ⎪
⎬ full bins 42 31 41 26 25 22
42 41 31 26 25 22
Bin 5: H(60) + I(60) ⎪ b 15
Bin 6: J(75) + E(45) ⎭
3
Bin 7: B(30) + C(30) + D(45) 8 4 13 2 17 9 15
3 a e.g. First-fit does not rely on observation.
2 8 4 13 17 9 15
b 4
c Bin 1: A, B, C, D; Bin 2: E, I, J; Bin 3: F, G, H 2 8 4 13 9 15 17
Each of the three lanes is full, so solution is optimal. 2 8 4 9 13 15 17
4 a 4 rolls
b 5 rolls, 15 m wasted 2 4 8 9 13 15 17
c Doesn’t always give an optimal solution
2 4 8 9 13 15 17
d e.g. Bin 1: A, C, L; Bin 2: B, D, E, F; Bin 3: G, H, I,
Bin 4: J, K 2 4 8 9 13 15 17
No carpet is wasted.
5 a Bin 1: H(25) + A(8) 4 a 111 103 77 81 98 68 82 115 93
Bin 2: G(25)
Bin 3: F(24) + B(16) 111 103 115 98 77 81 68 82 93
Bin 4: E(22) + C(17) 111 115 103 98 77 81 82 93 68
Bin 5: D(21)
b Lower bound is 4. 115 111 103 98 93 82 77 81 68
c There are 5 programs over 20 GB. It is not possible 115 111 103 98 93 82 81 77 68
for any two of these to share a bin. So at least 5 bins
will be needed, so 4 will be insufficient. b i Bin 1: 115 + 82
Bin 2: 111 + 81
Exercise 1F Bin 3: 103 + 93
1 a Connock is in the list Bin 4: 98 + 77
b Walkey is in the list Bin 5: 68
c Peabody is not in the list ii No room in bin 1 (3 left) or bin 2 (8 left) or bin 3
2 a 21 is in the list (4 left) but room in bin 4.
b 5 is not in the list 5 a Rank the times in descending order and use them
3 a 7 b 10 c 14 in this order. Number the bins, starting with bin 1
each time.
Online
Worked solutions are available in SolutionBank.
ANSWERS 211
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
b Bin 1: 100 c Middle of the list is Hyo. Kim follows Hyo. Consider
Bin 2: 92 sublist : J K M R T
Bin 3: 84 + 30 Middle of list is Merry. Kim comes before Merry.
Bin 4: 75 + 42 Consider sublist: J K
Bin 5: 60 + 52
unused space on DVD: 65 minutes Middle of list is Kim. Kim found. Kim is in the list.
c There is room on DVD 2 for one of the 25-minute
programmes but no room on any DVD for the
second programme. CHAPTER 2
6 a The two 1.2 m lengths cannot be ‘made up’ to Prior knowledge check
2 m bins since there are only 3 × 0.4 m lengths. 1 If a = b + c, then ABC would be on a straight line, and if
Two of these can be used to make a full bin, a . b + c, then sides b and c would not have sufficient
1.2 + 0.4 + 0.4, but the second 1.2 m cannot be combined length to meet at a single point A
made up to 2 m since there is only one remaining
0.4 m length. 2 AECD = 12
b Bin 1: 1.6 + 0.6
Bin 2: 1.4 + 1
Exercise 2A
Bin 3: 1.2 + 1.2 1 a i a student ii that a pair of students are friends
Bin 4: 1 + 1 + 0.4 b Banjit, Dhevan, Esme
Bin 5: 0.6 + 0.6 + 0.6 + 0.4 c e.g. Adok and Chris, Esme and Fabio
Bin 6: 0.4 2 a A B C D E F
c Bin 1: 1.6 + 0.4 + 0.4
Bin 2: 1.4 + 1
Bin 3: 1.2 + 1.2
Bin 4: 1 + 1 + 0.4
Bin 5: 0.6 + 0.6 + 0.6 + 0.6
7 a Output 4.8
b It selects the number nearest to 5.
c It would select the number furthest from 5. Mathematics Physics Chemistry Biology Art English
8 a 1st pass: 2.0 1.3 1.6 0.3 1.3 0.3 0.2 2.0 0.5 0.1 b Mathematics and art
2nd pass: 2.0 1.6 1.3 1.3 0.3 0.3 2.0 0.5 0.2 0.1 3 a i One change. For example, Chancery lane to
3rd pass: 2.0 1.6 1.3 1.3 0.3 2.0 0.5 0.3 0.2 0.1 Notting Hill Gate on red line, then Notting Hill
4th pass: 2.0 1.6 1.3 1.3 2.0 0.5 0.3 0.3 0.2 0.1 Gate to Victoria on the yellow or green line.
5th pass: 2.0 1.6 1.3 2.0 1.3 0.5 0.3 0.3 0.2 0.1 ii hrough 4 stations. For example, Chancery
T
6th pass: 2.0 1.6 2.0 1.3 1.3 0.5 0.3 0.3 0.2 0.1 Lane – Holborn – Tottenham Court Road – Oxford
7th pass: 2.0 2.0 1.6 1.3 1.3 0.5 0.3 0.3 0.2 0.1 Circus – Green Park – Victoria.
8th pass: 2.0 2.0 1.6 1.3 1.3 0.5 0.3 0.3 0.2 0.1 b i Marylebone to Waterloo on the brown line.
b Bin 1: 2.0; Bin 2: 2.0; Bin 3: 1.6 + 0.3 + 0.1 7 × 80 = 9 min 20 sec
Bin 4: 1.3 + 0.5 + 0.2; Bin 5: 1.3 + 0.3 ii Victoria to Gcreen park (light blue line), green
5 lengths of pipe needed park to baker street (grey line).
c Yes: Total length required is 9.6 m, so lower bound 3 × 80 + 180 = 7 min.
is 4.8, rounded up to 5 lengths of pipe. iii Holborn to Oxford Circus (red line), Oxford Circus
9 M V C A D B K S to Victoria (light blue line), Victoria to St James
Park (yellow or green line)
C A B D M V K S
5 × 80 + 2×180 = 12 min 40 sec
A C B D K M V S
4 a 40 min
A B C D K M S V b Aberdeen/Cork
A B C D K M S V c Dublin − it is the airport with the most connections
5 a PTV
Challenge b Not correct. PTQRSV is 25 km
a The names are not in ascending alphabetical order and
so a binary search cannot be done. Challenge
b a 6 routes b 18 routes
J M C B T H K R G F
J C B M H K R G F T Exercise 2B
1 a For example:
C B J H K M G F R T
B C H J K G F M R T
B C H J G F K M R T
B C H G F J K M R T b
B C G F H J K M R T
B C F G H J K M R T
B C F G H J K M R T
212 ANSWERS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
c 6 a For example
2 a is not simple.
4 vertices of degree 2
There are two edges connecting C
with D. b For example
b and c are simple.
d is not simple. There is a loop attached to U.
3 a and c are connected.
b is not connected, there is no path from J to G, f
or example.
d is not connected, there is no path from W to Z, 3 vertices all even, all of degree 2
for example. c The sum of degrees = 2 × number of edges, so the
sum of degrees must be even. Any vertices of odd
4 a Any four of these:
degree must therefore ‘pair up’. So there must be
F A B D FED
an even number of vertices of odd degree.
F A C B D FECBD
7 2 16
F A B C E D F E C A B D
FACED
b e.g. F A C B D E F, D B A F E D
c Vertex A B C D E F
Degree 3 3 3 2 3 2
C D 9 x = 2
e Sum of degrees = 3 + 3 + 3 + 2 + 3 + 2 = 16
number of edges = 8
Exercise 2C
sum of degrees = 2 × number of edges for this graph
1 a and b are trees.
5 c is not a tree, it is not a connected graph.
Vertex J K L M N P Q R S d is not a tree, it contains a cycle.
Degree 1 2 3 1 1 4 2 1 1 2 i
S
P
R iii
L
iii J S
Sum of degrees = 1 + 2 + 3 + 1 + 1 + 4 + 2 + 1 + 1 = 16
iv
number of edges = 8
sum of degrees = 2 × number of edges for this graph
Online
Worked solutions are available in SolutionBank.
ANSWERS 213
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
v Exercise 2D
1 A B C D E F G
A 0 1 1 0 2 0 0
B 1 2 1 0 0 0 0
vi
C 1 1 0 2 0 1 0
D 0 0 2 0 0 1 1
E 2 0 0 0 0 1 0
F 0 0 1 1 1 0 1
vii
G 0 0 0 1 0 1 0
2 a A B
viii
C
ix E D
b A B
C
D
xi
c A B
3 BCEF
4 A, C
5 a i A tree is a connected graph with no cycles.
ii A spanning tree is a subgraph which includes all
D C
vertices and is a tree.
b The graph is not connected. d A B
6 a
D C
b Each vertex will have a degree of n − 1
c 190 3 a A
23 21
E B
Challenge 20
23
22
17
41
D 18 C
b A B
8 11
9
F
15 17 13 C
8
E 10 D
214 ANSWERS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
4 iii
A B C D E F
A — 14 11 — — —
B — — 10 13 11 —
C — — — 12 — —
4 a A distance matrix gives the weights of edges
D — — — — — 10
between pairs of vertices, whereas an adjacency
E — — — — — 7 matrix gives the number of edges between pairs of
F — — — — 9 — vertices.
b A B C D E F
5 a A B A — 20 18 16 — —
B 20 — 15 — — 50
C 18 15 — 10 20 30
C
D 16 — 10 — 23 —
E — — 20 23 — 25
E D
b E F — 50 30 — 25 —
c A B c e.g. B
F
20 30
18
A 20
C C
16 E
E D D
Weight = 104
Chapter review 2 5 v − 1
1 11 B 6 PQR, PQTR, PTR, PSR
A
7 a 3
b i e.g. BEAD ii e.g. ACEA
9 c i e.g. A
15
D C E B
16
8
2 a, e and h are isomorphic. D C
b and i are isomorphic. ii e.g. A
c and g are isomorphic.
d and f are isomorphic.
3 a B
C
8 a The sum of the degrees of the vertices must be
even. However, 3 + 1 + 2 = 7 is odd, so there is no
4-vertex graph whose vertices have these degrees.
b i b 5
9 a AGBECFDHA
b e.g. ACEBFDA
Challenge
a V = 7, E = 13, R = 7; 7 + 7 − 13 = 1
b
ii
V = 1, E = 4, R = 4; 1 + 4 − 4 = 1
c E = R, so V + R − E = V = 1
Online
Worked solutions are available in SolutionBank.
ANSWERS 215
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
H 12 12 E 5 6 7
18 D
15 11
G F 8
weight:
EF, BD, CD, AH, DF, AC, GH; weight9898
The three shortest edges form a cycle.
b C
A 4 a Cl
6
B 7 0.8
4 1.4 Ce
M S 1.9
2 2.8 2.3 1.6
5 D H
R
3 P 3.1 E
F 1.1
G
Sh
E Arcs were added in the order MCl (0.8), ShR (1.1),
BF, FG, AB, CE, BC, CD;
weight: 27weight 27 ClS, CeR, CeH, SR, ME, PE
c C b 15 km
3.8 2.1
A B
4.2 D
H E 1.4
3.8
1.7
2.3
J F
3.1
G
DE, EF, CD, EG, GJ, AB, GH, BH; weight 22.4
weight: 22.4
216 ANSWERS
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
Exercise 3B b $17 340
c Replace WX with VX. This is the cheapest way to
1 A
link X to the spanning tree. The total cost is now
16 $231 000 + $28000 − $19000 = $240 000
14 C 5 a Prim’s algorithm identifies the next node to link to
B the existing tree. Linking a new node cannot form
H 12 a cycle.
18 12 b One minimum connector is shown below.
D E
B Order of
15 11 connection
G 4 D
F 10 J AB
8
weight: 98 A F 9 BC
10 8 CD
9 I
b C 8 K DE
A C
6 G L 7 DF
B E FG
4 7 8
6 GH
H HL
2 KL
5 D
Total weight = 87 IK
3 IJ
F
c The minimum connector is not unique; there are
G
three minimum connectors with total weight 87.
E
Exercise 3C
weight: 27 1 a Arcs in order:
c C AF (9)
FB (14)
A 3.8 2.1 AC (20)
AE (25)
4.2 D DE (26)
H E 1.4 weight = 94
1.7 b Arcs in order:
3.8 RS (28)
2.3 ST (16)
F SU (19)
J UV (37)
3.1 G
weight = 100
weight: 22.4 2 Arcs in order:
2 In Prim’s algorithm, the starting point can be any node, BS (78.4)
whereas Kruskal’s algorithm starts from the arc of SM (70.4)
least weight. SN (89.6)
In Prim’s algorithm, each new node and arc are added NL (59.2)
to the existing tree as it builds, whereas in applying weight = 297.6
Kruskal’s algorithm, the arcs are selected according to 3 a cost = €1014
their weight and may not be connected until the end. b D
3 a 35 H
H C 3.1 A 42
D
1.8 48
2.4 52
47 53
A E F
4.6 B 3.4 E
2.8 61 G
2.3 C
G F
B
Selection order: AH, AG, AB, BC, CD, BF, EF i It is cheaper to translate from E to H then from H
c
b 17 340 to G at a cost of 48 + 52 = 100 euro rather than
4 a Q T W 159 euro per 1000 words.
27
ii A direct translation is likely to be more accurate
27 15 41 then a translation via another language.
S 18
P V Y
31 19
29
24
R U X
Online
Worked solutions are available in SolutionBank.
ANSWERS 217
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
b Start off the tree with QT and PR then apply 7 a Possible paths are A − H − G − E − I − K
Kruskal’s algorithm. Prim’s algorithm requires the and A − H − J − I− K
‘growing’ tree to be connected at all times. When and A − B − C − K
using Kruskal’s algorithm the tree can be built from i A, B, F, H, D, G, J, E, C, I, K
non-connected sub-trees. ii 44 − 9 = 35 IK 44 − 9 = 35 IK
L 35 − 10 = 25 EI 35 − 17 = 18 JI
M 25 − 10 = 15 GE or 18 − 8 = 10 HJ
3.8
T 15 − 5 = 10 HG 10 − 10 = 0 AH
3.8 N 10 − 10 = 0 AH
6.6 or
9.2 4.7 44 − 12 = 32 CK
S 6.6 Q 32 − 25 = 7 BC
R 7 − 7 = 0 AB
7.5 P b A − H − G − E − I − K and A − H − J − I − K
and A − B − C − K
3 a C
c The arcs could be roads.
The nodes could be junctions.
52 The number on each arc could be distance in km.
84 97 58 41 The network, together with Dijkstra’s algorithm,
could be used to find the shortest route from A to K.
B F A E D 8 Order of vertex labelling:
length 332 mm order: AC, AE, ED, AF, FB
Selection S C B A E D G F T
b length 332 mm Route: S − C − E − F − T
4 a Arcs in order: Entrance 2−Office; Entrance 2− 411 − 101 = 310 FT
Entrance 4; Entrance 4−Entrance 3; Office−Entrance 1 310 − 123 = 187 EF
187 − 85 = 102 CE
Entrance 1 Entrance 2 Entrance 3
102 − 102 = 0 SC
1514 587 9 a B
488
523 17
Office A
Entrance 4 15 C
b length 3112 m 19 Total weight = 72
5 a 29 27 30 19 9 26 17 18 8 12 24 20 14 14 22 26 D
E 21
8 29 27 30 19 9 26 17 18 12 24 20 14 14 22 26
b Students’ own answer
8 9 17 12 14 14 18 29 27 30 19 26 24 20 22 26
c Prim’s algorithm may be quicker on a graph with a
8 9 12 17 14 14 18 19 24 20 22 26 29 27 30 26 large number of arcs, such as a complete network,
8 9 12 14 17 14 18 19 20 24 22 26 29 27 26 30 as Kruskal’s algorithm would require arcs to be
sorted by weight. 10 a
8 9 12 14 14 17 18 19 20 22 24 26 26 27 29 30
10 a D
EF CD EJ FJ GI CG DG BC FI HK EK CF JK AE AB AH
b, c C
1290
B 19 C 1450
A 27 9 960
E 8 F A
17
24 D
12 20 G
H 2010
22 K G
14 440
J I Total weight = 172
d e = v − 1 B
F 1100
6 a weight = 45 so 4500 m needed
C 3 F H
1 E
680
A 3 3
L
2 5
D 6 4 H
4 G I N weight of MST = 7930 km
4 4 b C − G − B − E − H − A − D − F weight = 9620 km
M c MST × 2 = 15 860 , nearest neighbour and return
3 = 13 080. The method using the nearest neighbour
B E J 3 K
will give the shortest way.
b weight = 47 so 4700 m
Online
Worked solutions are available in SolutionBank.
ANSWERS 219
Uncorrected proof, all content subject to change at publisher discretion. Not for resale, circulation or distribution in whole or in part. ©Pearson 2018
13 a Route: S − A − C − G − T, length: 82 With 5 lines there must be at least three of one
C 6 54 colour so there are four points connected by the
20 same colour.
54
A 3 34 16
34 11
34 D 5 45 26 G 9 70 A
S 1 0 46 45 76 71 70 12
0 24 33 T 10 82
E 4 43 84 82
22 For the three lines connecting the new points,
B 2 22 43 25 if one is the original colour then a set of three
21 18
22 H 8 66 vertices is made with the original colour. If none
34 F 7 56 68 66 are the original colour then the three vertices
56 10 make a set of three themselves.
b For example 82 − 12 = 70 GT
70 − 16 = 54 CG
54 − 20 = 34 AC A A
34 − 34 = 0 SA
c Shortest route from S to H + HT S − B − F − H − T
length: 84 iii
14 a A 1 0 B 3 4 C 7/8 10 D 12 6
4 6 6
0 4 10 16
1 2 8 4
E 2 1 4 F 4 5 5 G 8/7 10 2 H 10/9 12
1 5 10 12 2 a G
5 7 3 1 70 + 2x 40 + 5x
165 + 5x, 265 + 2x
B 8 195 A 5 125
I 5 6 2 J 6 8 4 K 9/10 12 1 L 11 13
6 12 8 12 13 200 195 125
60 50
For example 70 30
13 − 1 = 12 HL or 13 − 1 = 12 KL
12 − 2 = 10 GH 12 − 4 = 8 JK C 7 135
F 6 130 E 4 95
10 − 5 = 5 FG 8 − 2 = 6 IJ 30 140 135 40
5 − 4 = 1 EF 6 − 5 = 1 EI 130 95
1 − 1 = 0 AE 1 − 1 = 0 AE
Shortest path is { } length 13
A−E−F−G−H−L 90 95 70
130 140
A−E−I−J−K−L
b State the other path. I 2 50 D 3 80
50 80
Challenge H 1 0
50 80
1 a Let G be any simple graph with more than one
vertex and with number of vertices = n > 2. 0
The maximum degree of any vertex in G is < n − 1. Via A H − E − A − G length 165 + 5x
Also, if our graph G is not connected, then the Via B H − E − C − B − G length 265 + 2x
maximum degree is < n − 1.
b 165 + 5x = 265 + 2x ⇒ x = 33 __13
Case 1: Assume that G is connected. We cannot
have a vertex of degree 0 in G, so the set of vertex So range is 0 < x < 33 __13
degrees is a subset of S = {1, 2, … , n − 1}. Since the
graph G has n vertices and there are n − 1 possible CHAPTER 4
degree options, there must be two vertices of the
same degree in G. Prior knowledge check
Case 2: Assume that G is not connected. G has no 1 a 16
vertex of degree n − 1, so the set of vertex degrees is b Sum of orders = 2 × number of arcs
a subset of S9 = {0, 1, 2, … , n − 2}. Again we have n c 4
vertices and n − 1 possible degree options, so there d From part b, the sum of the valencies must be even.
must be two vertices of the same degree in G.
b i Possible sets are: Exercise 4A
Blue: ABD, ACD
1 a Vertex
Red: BCF, DEF A B C D E F
ii For K6 any vertex will have a valency of 5, an Degree 2 3 2 3 3 3
edge to each of the other points.
There are 4 nodes with odd degree so the graph is
A neither Eulerian nor semi-Eulerian.
Online
Worked solutions are available in SolutionBank.