Transcript
Page 1: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Practical Activities for teaching Decision Mathematics

MEI Conference 29th July 2009

Jeff Trim - [email protected]

Graph Theory Word Maze

A puzzle activity for reinforcing Graph Theory vocabulary A Handful of Mathematicians

Short biographies of 5 pioneers of Decision Mathematics Graph Theory Vocabulary – Hexagon Puzzle

Tarsia puzzle for revising definitions of common Graph Theory terms Instant Insanity

This activity demonstrates the power of Graph Theory to solve problems Bin Packing Exercise

A practical activity which practises bin-packing but demonstrates that the algorithms do not necessarily lead to an optimal solution

Algorithms for Sorting

The differences between four sorting algorithms are emphasised by using numbered playing cards and a practical approach

Sprouts

A pen-and-paper game using nodes/vertices and arcs/edges which can be easily analysed using familiar concepts

Page 2: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

There are 20 words associated with Graph Theory hidden in the square below. The Start and Finish squares are indicated and the words lie in a continuous path from one to the other. All moves are horizontal or vertical (not diagonal.). The initial letter of each word and the order in which they appear are given to stop you getting lost!

Start A R L A N E B I P A R

E C P C Y C T O R E T

D G E L E E N U T T I

D E E R T C A W E G R

E A I D J A L K D I A

G R L A L P M O C H P

R T P O E T E I M P L

E E L O R E V S A H E

N N X E T O D E M N I

E O C E U N N A I O A

C T E D L E R I L T N Finish

1. A

2. E

3. P

4. C

5. T

6. D

7. L

8. T

9. A

10. B

11. R

12. W

13. D

14. C

15. V

16. C

17. E

18. N

19. S

20. H

Page 3: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Start A R L A N E B I P A R

E C P C Y C T O R E T

D G E L E E N U T T I

D E E R T C A W E G R

E A I D J A L K D I A

G R L A L P M O C H P

R T P O E T E I M P L

E E L O R E V S A H E

N N X E T O D E M N I

E O C E U N N A I O A

C T E D L E R I L T N Finish

1. A R C

2. E D G E

3. P L A N E

4. C Y C L E

5. T R E E

6. D E G R E E

7. L O O P

8. T R A I L

9. A D J A C E N T

10. B I P A R T I T E

11. R O U T E

12. W A L K

13. D I G R A P H

14. C O M P L E T E

15. V E R T E X

16. C O N N E C T E D

17. E U L E R I A N

18. N O D E

19. S I M P L E

20. H A M I L T O N I A N

Page 4: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

A HANDFUL OF MATHEMATICIANS Short biographies of five of the mathematicians who have contributed to

Decision Mathematics and Graph Theory

Leonhard Euler

Prolific 18th Century mathematician and founder of modern graph theory, after whom is named the Eulerian Cycle

Sir William Rowan Hamilton

Childhood mathematical prodigy and later Astronomer Royal of Ireland, after whom is named the Hamiltonian Cycle

Robert Prim

Developer of Prim’s Algorithm for finding a minimum spanning tree Joseph Kruskal

Inventor of Kruskal’s Algorithm for finding a minimum spanning tree Edsger Dijkstra

Computer scientist best known for the Dijkstra Algorithm to find a shortest path between two vertices

Page 5: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

EULER Leonhard Euler (pronounced ‘Oyler’) (1707-1783) b. Switzerland; lived and worked in Russia and Germany

Euler was an extremely prolific mathematician, contributing to the understanding of such diverse areas as calculus, topology, optics and astronomy. He popularised the use of the specific symbols i (for √ -1), e and π. In particular, whilst the base for the natural logarithm had been discussed earlier by mathematicians with the symbol b, it was Euler who first used e to represent this constant in his book ‘Mechanica’ of 1736. Although e is sometimes referred to as Euler’s Number, his innate modesty precludes the thought that the letter was chosen because it was his initial! His name is given to the Eulerian Cycle; a closed path which traverses every edge in a graph exactly once. A graph which contains such a path is called an Eulerian Graph and the simple test is that the graph must be connected and have no vertices of odd degree. If there are two odd nodes, the graph will be semi-Eulerian, where the path starts and finishes at different points and so cannot be a cycle. The concept of an Eulerian Cycle relates back to a puzzle that Euler proved could not be solved concerning the seven bridges of Kőnigsberg. A feature of this Prussian city (now called Kaliningrad) was the seven bridges across the river Pregel and its tributaries. The challenge was to find a route whereby a citizen could cross every bridge once and return home again. In creating the mathematics to show that such a cycle was impossible, Euler became the founding father of topology. Euler lost the sight in his right eye after a life-threatening fever, although he blamed the loss on over-work. It is at this stage in his life that the well-known portrait (seen above) was painted. The sight in his left eye was subsequently lost due to a cataract. The fact that he continued to work, using his two sons as amanuenses, is testimony to his photographic memory and phenomenal skills of mental calculation. Amongst a range of other results named after him, is Euler’s Identity: eiπ + 1 = 0. This remarkable brief statement combines the five most important mathematical numbers using the four basic operations of addition, multiplication, exponentiation, and equality, each used exactly once.

Page 6: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

HAMILTON Sir William Rowan Hamilton (1805-1865) b. Dublin, Ireland; lived in Ireland

William Hamilton was the son of a Dublin solicitor and his intellectually gifted wife, although both parents had died by the time William was 14. His prodigious talent was evident very early on and from the age of 3 he was sent to live with his uncle, Reverend James Hamilton in the village of Trim (about 20 miles from Dublin). This uncle, an accomplished linguist and polymath, instructed William, who at the age of 13 could claim that he had mastered a language for each year he had lived. Even prior to his graduation, at age 22 he was appointed Professor of Astronomy at Trinity College, Dublin, Director of the Dunsink Observatory and Astronomer Royal for Ireland. He was knighted at 30 and in 1837 became President of the Royal Irish Academy. He is considered to be Ireland’s greatest man of Science. Hamilton made valuable contributions to various different fields of science; algebra, optics, dynamics and quantum mechanics. Of interest to pure mathematicians is his pioneering work in the discovery of Quaternions, involving the extension of the concept of complex numbers into four dimensions. He may also be considered as the inventor of the ‘cross product’ and ‘dot product’ of vector algebra. In graph theory, a cycle which visits every vertex in a graph exactly once is known as a Hamiltonian Cycle. The still-unsolved Travelling Salesman Problem is a variation on this principle, where a tour of minimum length must be found which visits each vertex at least once. In 1857, in his spare time Hamilton invented The Icosian Game, based on the twenty vertices of an Icosahedron. The simple nature of the game was that the player, given the first five vertices, had to complete the route through the remaining fifteen vertices without repeats. The game was subsequently sold to a London games dealer, John Jaques & Sons, who marketed it in two forms – flat for parlour use and hand-held for journeys – under the name “Around the World”. The game was not a commercial success and Hamilton, who was paid £25 outright, had the better part of the bargain!

Page 7: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

PRIM Robert Clay Prim (1921- ) b. Sweetwater, Texas, USA

Robert Prim was a graduate of Princeton University, where he studied Electrical Engineering and subsequently (after World War II) also Mathematics, also remaining for a couple of years as a research associate. During the war years, he had worked as an engineer and been employed by the United States Naval Ordnance Laboratory. Robert Prim spent the late 1950’s and early 1960’s working at Bell (Telephone) Laboratories and then moved on to become Vice President of Research at Sandia National Laboratories. It was at Bell Laboratories, where he was Director of Mathematics research, that he developed Prim’s Algorithm for finding a Minimum Spanning Tree. It is for this that he is best known in Decision Mathematics. Together with his co-worker, Joseph Kruskal, two different methods were developed. In fact Prim’s algorithm had previously been discovered in 1930 by Vojtech Jarnik, was independently found by Prim in 1957 and subsequently rediscovered by Edsger Dijkstra in 1959. It is sometimes therefore called the DJP Algorithm! In contrast to Kruskal’s Algorithm, which focuses on the systematic selection of edges, Prim’s Algorithm builds up a set of connected vertices by progressively adding in the vertex least distant from the existing set, whilst ensuring none are revisited, thus avoiding cycles. The edges used form the minimum spanning tree of the graph. This algorithm was first published in the ‘Bell System Technical Journal’ in 1957.

Page 8: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

KRUSKAL Joseph Bernard Kruskal (1928- ) b. New York, USA

Joseph Kruskal is a graduate of the University of Chicago with a PhD from Princeton University. He is a fellow of the American Statistical Association and former President of the Psychometric Society. He has also campaigned for civil rights and fair housing. Joseph Kruskal worked with Robert Prim at the Bell Laboratories where they developed two different approaches to the same problem. Formerly know as the Bell Telephone Laboratories, their practical application was focussed on communications networks. These can be represented as graphs with weighted edges. Kruskal’s Algorithm, also known as the ‘Greedy algorithm’, is a method for finding a Minimum Spanning Tree for a given network by choosing in turn the edges with the lowest weights whilst avoiding the creation of cycles. In fact the term greedy algorithm is a more general expression meaning a process which chooses at a given stage during each iteration the best option at that point. Kruskal’s Algorithm was first published in the ‘American Mathematical Society Proceedings’ in 1956. Kruskal later said that he regretted that the term minimum spanning tree has taken hold, claiming that ‘minimum’ is too vague; minimum in what way? He stated: “I always think of the concept as ‘shortest spanning subtree’ and hope someday to see SST replace MST.” Joseph Kruskal also had two brothers who were renowned in different areas of mathematics and physics; Martin Kruskal, the co-inventor of ‘solitons’ and ‘surreal numbers’ and William Kruskal, who developed the Kruskal-Wallis one-way analysis of variance.

Page 9: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

DIJKSTRA Edsger Wybe Dijkstra (pronounced ‘Deekstrah’) (1930-2002) b. Rotterdam, Netherlands; worked in Amsterdam and also Texas, USA

Edsger Dijkstra studied Theoretical Physics at the University of Leiden before moving into the field of Computer Science. He worked for the Mathematisch Centrum in Amsterdam and then the Burroughs Corporation, which had progressed from making adding machines to typewriters and computers. He later held the Schlumberger Centennial Chair in Computer Sciences at the University of Texas. He wrote prolifically on programming and observed that “programming is so inherently difficult and complex that programmers need to harness every trick and abstraction possible in hopes of managing the complexity of it successfully”. He was renowned for working carefully in fountain pen and then photocopying and distributing these manuscripts, each numbered with EWD as the pre-fix. More than 1300 of these hand-written articles are known to exist. In Graph Theory, he is known best for Dijkstra’s Algorithm for finding the Shortest Path between two points in a network, which he developed in 1959. This is a labelling procedure which identifies the smallest total path length to each vertex from the starting point. Tracing back from the finish vertex finds the shortest path itself. It is an example of a greedy algorithm because of the step during each iteration where the vertex with the lowest working value is chosen as the best and is then permanently labelled. He received the 1972 Turing Award (after Alan Turing, the British mathematician who helped break the German Enigma code in WWII) for fundamental contributions in the area of programming languages. Despite a career in programming, Dijkstra only owned one computer in his life. Even then it was after pressure from his colleagues and just used for email and internet browsing. This is in keeping with his quoted opinion that: “Computer Science is no more about computers than astronomy is about telescopes.”

Page 10: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

More than one edge between

the same pair of vertices

Semi−Eulerian Graph

Line

from

ver

tex

to v

erte

x

Minimum Spanning Tree

Bipartite Graph

Node Value

A walk with no

repeated edges

A Tr

ail w

ith n

ore

peat

ed v

ertic

es

Digraph

Simple G

raph

The number associated

with an edge

... can be drawn w

ithout edges crossing

Walk

... where a path exists between

any pair of vertices

A su

bset

of t

he v

ertic

esan

d ed

ges o

f a la

rger

gra

phNetw

ork

Point where edges m

eet

Graph withdirectional edges

K5

Page 11: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Connected Graph with

one pair of odd vertices

Graph with no cycles

Trai

l

Node

... connects all vertices with

the least total edge length

Node with edge 4 connections

Vertex with odd degree

Path

Graph where two distinct s

ets

of vertices

are not joined

by any common edges

Arc

Com

plete graphw

ith five vertices

Connected graph

with no odd nodes

TreeW

eight

Cycle Eule

rian

Cyc

leVerte

x

Odd node

... traverses every

edge exactly once Com

plet

e G

raph

Page 12: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Edge

Edge

A se

quen

ce o

fco

nsec

utiv

e ed

ges

Vertex of degree

4

Ham

iltonian Cycle

Valency Plan

ar G

raph

Degree of a vertex

Repeated edge

Point where edges m

eet

... has no loops

or repeated edges

Subgraph... w

here every vertex isjoined to every other vertex

Graph consisting

of arcs and nodes

... a closed pathIs

omor

phic

Gra

phs

Valency

Differen

t shaped graphs w

ith

the same verte

x connections

Connected G

raph

... visits every vertex

exactly once

Eulerian Graph

Page 13: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Verte

xOdd node

Netw

ork

Point where edges meet

Graph consisting

of arcs and nodes

... a

clos

ed p

ath

Isomorphic Graphs

Euler

ian

CycleCycle

... traverses every

edge exactly once

Complete GraphVe

rtex o

f deg

ree 4

Hamiltonian Cycle

Path

Node with edge 4 connections

Vertex with odd degree

A Trail with no

repeated vertices Node

Val

ueA walk with norepeated edges

Conn

ecte

d G

raphValency

Different shaped graphs withthe same vertex connections

... where a path exists between

any pair of vertices

A su

bset

of th

e ver

tices

and e

dges

of a

large

r gra

ph

Walk

... ha

s no l

oops

or re

peat

ed ed

gesSubgraph

... where every vertex isjoined to every other vertex

Simple Graph

Digraph

Euler

ian

Gra

ph

... visits every vertex exactly once

Connected graph

with no odd nodes

Tree

Weight

Conn

ecte

d G

raph

with

one p

air o

f odd

ver

tices

Graph with no cycles

Trail

Semi−Eulerian G

raph

Line

from

ver

tex

to v

erte

x

More than one edge between the same pair of vertices

Edge

Edge

A sequence ofconsecutive edges

Arc

Com

plete

grap

h

with

five

ver

tices

Graph where two distinct sets of vertices are not joined by any common edges

K5

Graph withdirectional edges

... ca

n be

dra

wn w

ithou

t

edge

s cro

ssin

g

The number associated with an edge

Planar Graph Valen

cy

Poin

t whe

re ed

ges m

eetDegree of a vertex

Repeated edge

Node

... co

nnec

ts al

l ver

tices

with

the

leas

t tot

al ed

ge le

ngth

Minim

um Spanning Tree

Bipartite Graph

Page 14: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Variations of this puzzle have been published and marketed under various titles over the years, but all have the same underlying design. The challenge is to stack four cubes such that each side of the stack shows four different images. The puzzle can be very frustrating to solve by trial and error, but yields very quickly to the approach described below. It is an excellent way to introduce applications of graph theory without straying into the common algorithms on the syllabus such as minimum spanning trees and shortest paths. In particular, it gives students a chance to use vocabulary such as vertex, edge, and sub-graph. Preparation: Nets for the puzzle can be found here: http://nrich.maths.org/public/viewer.php?rss=1&obj_id=443&part=index Symbols can be used for the cube faces instead of colours. Duplicate the puzzle sheet onto four different pale shades of paper and roughly cut out the nets. Distribute so that each student has each of A, B, C and D in a different colour. Paper is ideal for this (rather than card) and glue is not required. Scissors and coloured pencils to match the paper shades are needed. It really benefits the finished cubes if the folds are creased firmly first! Method: When students have made up the cubes and tried the problem, introduce the idea of using a graph to represent the symbols on opposite sides of each cube. Prepare a graph with four vertices. Assign one symbol to each vertex.

For each cube, add three colour-coded edges to the graph. Each of these three arcs will connect the vertices corresponding to the symbols on each pair of opposite faces. The resulting graph will contain twelve arcs, three of each colour.

Page 15: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Sub-graphs: The students need to find and draw two distinct sub-graphs, each of which contains one arc of each colour and in which each of the four vertices has degree two (i.e. is a ‘two-node’). The sub-graph need not be connected, but I have chosen two connected sub-graphs for my own solution. One nice outcome is that students will have a graph specific to their combinations of colours and therefore probably different to the person next to them! However, if the vertices have been labelled in the same way, at least the graphs will be isomorphic, ignoring the colours. Interpreting the Solution: Label one sub-graph “Left-Right” and the other “Front-Back”. Label the clockwise direction by each graph.

Left – Right Front - Back The arcs of each colour, read clockwise, indicate how each cube is to be arranged in the tower. E.g. a green arc from flower to circle (as you read clockwise) on the Left-Right sub-graph means that on the green cube, the pair of opposite faces that are the flower and circle need to be arranged with the flower on the left and the circle on the right (from the student’s point of view!). It is often necessary to demonstrate how to do this for at least one cube! The solution omits one arc from each cube used in the original graph. These arcs correspond to the top and bottom faces that are concealed in the tower.

Page 16: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

The solution shown here is based on the four cubes having the following colours:

A – Green B – Purple C – Orange D – Blue

Graph:

Sub-graphs:

Left – Right Front - Back [See also p. 13-14, AEB Discrete Mathematics, Heinemann, 1992.]

Page 17: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Where objects of varying sizes must be placed into containers of a fixed capacity, the problem is described as ‘bin packing’. The name is used for any problem of this general type, whether to do with objects, lengths, times or whatever the scenario. Two algorithms are commonly used to attempt to solve these problems: First-Fit Bin Packing:

First-Fit Decreasing Bin Packing:

Activity A builder uses piping of standard length 12 metres. The following sections of varying lengths are required for a particular job:

Section A B C D E F G H I J K L

Length (metres) 2 2 3 3 3 3 4 4 4 6 7 7

Explore how many standard 12 m lengths of pipe will be required if each of the following methods is used:

(a) First-fit bin packing (b) first-fit decreasing bin packing

(c) trial and improvement

[Adapted from p. 209-210, AEB Discrete Mathematics, Heinemann, 1992]

Reorder the items into decreasing order of size. Number the bins, then always place the next item in the lowest numbered bin which can take that item.

Number the bins, then always place the next item in the lowest numbered bin which can take that item.

Page 18: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Bins

12

11

10

9

8

7

6

5

4

3

2

Leng

th o

f sta

ndar

d pi

pe s

ectio

n (m

etre

s)

1

1 2 3 4 5 6 7 8

12

11

10

9

8

7

6

5

4

3

2

Leng

th o

f sta

ndar

d pi

pe s

ectio

n (m

etre

s)

1

1 2 3 4 5 6 7 8

Page 19: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Pipe Sections

A(2)

B(2)

C(3)

D(3)

E(3)

F(3)

K(7)

L(7)

G(4)

J(6)

H(4)

I(4)

A(2)

B(2)

C(3)

D(3)

E(3)

F(3)

K(7)

L(7)

G(4)

J(6)

H(4)

I(4)

Page 20: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

(a) First-fit bin packing

12

11

10

9

8

D(3)

7

G(4)

6

5

C(3) I(4)

4

F(3)

3 B(2)

2

Leng

th o

f sta

ndar

d pi

pe s

ectio

n (m

etre

s)

1 A(2) E(3)

H(4)

J(6) K(7) L(7)

1 2 3 4 5 6 7 8

(b) First-fit decreasing bin packing

12

11 A(2)

10

F(3)

9

8

G(4) H(4)

7

I(4) E(3)

6

5

4

D(3)

3

2

Leng

th o

f sta

ndar

d pi

pe s

ectio

n (m

etre

s)

1

K(7) L(7) J(6)

C(3) B(2)

1 2 3 4 5 6 7 8

Page 21: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

(c) Trial and improvement

12

11 A(2) B(2)

10

F(3)

9

I(4)

8

C(3) D(3)

7

E(3)

6

5

H(4)

4

3

2

Leng

th o

f sta

ndar

d pi

pe s

ectio

n (m

etre

s)

1

K(7) L(7)

G(4)

J(6)

1 2 3 4 5 6 7 8

Page 22: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

ALGORITHMS FOR SORTING

BUBBLE SORT Step 1: Compare the first two numbers.

Step 2: If the first number is larger than the second, exchange the numbers.

Step 3: Repeat steps 1 and 2 for all pairs of numbers until you reach the end of the list.

Step 4: Repeat steps 1 to 3 until no more exchanges are made.

SHUTTLE SORT The Shuttle Sort works by comparing pairs of numbers and exchanging them if necessary.

Step 1: Compare the first two numbers and exchange if necessary.

Step 2: Compare the second and third numbers and exchange if necessary, then compare the second and first numbers and exchange if necessary.

Step 3: Compare the third and fourth numbers and exchange if necessary, compare the second and third numbers and exchange if necessary, compare the second and first numbers and exchange if necessary.

Step 4: For a list of length n, continue until n-1 passes have been performed.

SHELL SORT The shell Sort differs from the Bubble and Shuttle methods as it compares, and possibly exchanges, non-adjacent elements.

The set of elements is split into subsets. The number of subsets for the first pass is INT(n/2), that is, the number of elements, divided by two and ignoring any remainder.

QUICK SORT

Step 1: Choose any number x from the list L, (usually the number at the mid-point – but for AQA, choose the FIRST).

Step 2: Write all the numbers smaller than x to the left of x, reading the original list from left to right. These form a new list L1. Write all of the numbers larger than x to the right of x reading the original list. These numbers form a new list L2.

Step 3: Apply steps 1 and 2 to each separate list until all of the lists contain only one number.

Step 4: The original list is now in ascending order.

Page 23: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

This is a simple pen-and-paper game for two players which involves arcs and nodes. It was invented in 1967 by Professor John H Conway and Michael S Paterson and has been described and analysed in books and on the internet. (Enter the words sprouts and Conway into a search engine for more information.) Sprouts with three spots: Draw three spots anywhere on the paper. Each player in turn draws a line joining one spot to another spot (or itself) and places a new spot somewhere on this line. No lines may cross, No spot may have more than three lines coming out of it (i.e. we would say that the degree of any vertex cannot exceed three). The game continues until no further moves are possible and the player to make the final move is the winner. A possible three spot game:

Page 24: Practical Activities for teaching Decision Mathematics - MEImei.org.uk/files/pdf/09conference/2009HandoutC4.pdf · Practical Activities for teaching Decision Mathematics MEI Conference

Analysis: Providing students have met the fact that for any graph the node-sum is twice the number of edges (from the hand-shake lemma), then it is quite easy to prove that a three spot game of sprouts can never exceed 8 moves. The game begins with 3 vertices and no edges. Every move adds to the network 2 edges and one vertex. Therefore after m moves, the network will have gained 2m edges and m vertices. So the final graph contains 2m edges and m + 3 vertices. Since the winning move will leave at least one vertex of degree 2, the maximum number of 3-nodes is m + 2. Therefore node sum ≤ (m + 2) x 3 + 2

and since node sum = 2 x (no. of edges)

we have 2 x (2m) ≤ (m + 2) x 3 + 2 so 4m ≤ 3m + 8 and so m ≤ 8 Thus no game of three spot sprouts can exceed 8 moves. Sprouts can be played with any number of spots and it can be shown that an n spot game will never exceed 3n – 1 moves. Brussels Sprouts: A similar game can be played with crosses instead of spots, where each cross represents a vertex of maximum degree 4. A move joins two ‘branches’ of existing crosses (or a cross to itself) and a cross is placed on the new line. The start of a possible two cross game:

In fact in Brussels Sprouts the first player always wins if the number of crosses is odd and the second player always wins where the number of crosses is even!


Top Related