algorithms and data structures teach that algorithms and data structures an algorithm does...

109

Upload: rosaline-horn

Post on 16-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 2: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

TEACH THAT

Page 3: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

An algorithm does something, solves some problem, in a mechanical way.It is a bit like a “machine” or a specialised tool

Page 4: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

A data structure is some way to represent and store dataso that we can process that data efficiently

Page 5: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

Data structures use algorithms

Algorithms use data structures

Page 6: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

Data Structures and Algorithmsa Computer Scientist’s building blocks

Page 7: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

Computer Scientist invent and study algorithms and data structures and problems

Page 8: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms and Data Structures

Computer Scientists do other things too

Page 9: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 10: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Our website, link from moodle

Page 11: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 12: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 13: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lecture

Page 14: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

14

Why don’t I just go away and read the book myself?

Why come to lectures? • meet new exciting people• keep in touch with fashion, trends, …• be part of the “in” crowd•

ADS2 Lecture 1

Lectures … Aye, right.

Page 15: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms&

Data Structures

Algorithms

&

Data Structures

Great!

Page 16: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 17: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Now and then I will take an attendance register

Page 18: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lassie, what’s in this ADS2 course ? Will it be interesting?

woof!

Page 19: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Content

• linked lists• single/doubly-linked, • insert, delete, find, min, max, …

• stacks• push/pop/size• bracket matching, RP calculator

• queues• enqueue/dequeue/size• circular queue (in array)

• recursion• see above

• big O

Page 20: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Content

• trees• n-ary trees: representations & properties• binary trees

• representations & properties & traversals• binary search trees

• insert/find/delete/traverse/height …• AVL trees• heap

• insert/delete/sort• splay trees (maybe)• red-black trees (maybe)

Continued

Page 21: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Content

• skip lists (maybe)• Sorting

• bubble/insert/sift sort• merge sort• quick sort• bucket sort (pigeon hole sort)• bead sort (maybe)

• Dictionaries• maps and hash tables

• open and closed hashing

Continued

Page 22: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

ContentContinued

• 5 pieces of practical work• 2 of above are assessed (20%)• exam in May (80%)• lab every 2nd week• woof

Page 23: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Algorithms&

Data Structures

Algorithms

&

Data Structures

Great!

Page 24: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 25: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

our ADS2 website under construction

(permanently)

Page 26: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Home

Page 27: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

News

Page 28: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

The lectures

Page 29: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

The lectures

Page 30: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

code & api

Page 31: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lots of code in there

Page 32: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

demos

Page 33: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Links to interesting & useful stuff

Page 34: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Links to interesting & useful stuff

Page 35: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

exercises

Page 36: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

exercises

Page 37: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

exercises

Page 38: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Questions & Answers

Page 39: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

… and now for something completely different!!!

Page 40: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lassie, why are algorithms and data structures important?

Page 41: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lassie, will there be anything in the course that is challenging and exciting?

Page 42: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

I just hope I get feedback, continuously

Page 43: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lassie, will you teach us to “THINK LIKE A COMPUTER SCIENTIST”?

Page 44: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Lassie, honestly, I’m not that experienced as a programmer. Will you help us with our programming?

Page 45: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 46: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Will we use BIG data sets?

Page 47: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

woof!

Page 48: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

1st lecture … “Who cares?”

Page 49: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

algorithms are ancient

Many algorithms predate computers

Page 50: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

But first … what is an algorithm?

Page 51: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

What is an algorithm?

A finite sequence of instructions, each with a clear meaning, and can be performed with a

finite amount of effort in a finite length of time [Aho, Hopcroft, Ullman 1983]

Page 52: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 53: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Before some of you were born

Page 54: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Abu Jafar Mohammed ibm Musa Al Khwarizmi

800AD

Before I was born

Page 55: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Euclid of Alexandria

325BC to 265BC

GCD

Page 56: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 57: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Data Structures … what’s that then?

Page 58: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

ways to organise data/information efficiently

where will I (not) see data structures?

Data structure

Data structure

Data structure

Not a Data structure – ADT (see next slide)

Page 59: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

abstract data types?

Page 60: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Definitions contd.

• Basically an ADT is an “abstract” entity• But a data structure has a fixed implementation (as well as

“structural” properties).

60ADS2 Lecture 2

Page 61: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Who cares?Machines are getting

bigger, faster, cheaper … do efficient data structures and

algorithms really matter?

Page 62: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 63: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

Bigger, faster, cheaper machines

Bigger data sets, greater expectations

Page 64: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

An Example: from problem to program

Sequencing traffic lightsA Formal Model

Page 65: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 66: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 67: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 68: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 69: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 70: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 71: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 72: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 73: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 74: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

A-left

A-right

Page 75: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

A-left

A-right

B-right

B-leftB-straight

Page 76: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

A-left

A-right

B-right

B-leftB-straight

C-straight

Page 77: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Page 78: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 79: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 80: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 81: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 82: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 83: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 84: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 85: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Draw a line (edge) between turns that CANNOT occur atthe same time

Draw a line (edge) between turns that CANNOT occur atthe same time

Page 86: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

Page 87: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 88: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 89: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

Page 90: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 91: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 92: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 93: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Label turns that have an edge between them (adjacent) differently.The minimum number of labels used Is the minimum (maximum) number of concurrent turns disallowed (allowed)

For “label” let’s use “colour”

Page 94: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Therefore we could allow same colouredturns to go at the same time: blue, green, pink and it will be collision-free

Page 95: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

We have 3 time steps

Page 96: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Could we do it in less than 3 time steps?Is this solution unique?What is the “underlying” problem?What is its complexity?Are there any algorithms that can be used?

Page 97: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Is Dobie’s Loan actually scheduled optimally?

Page 98: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

AL

AR

BR

BS

BL

CS

Might this be an obvious solution?

Page 99: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

Try This

One way

JoJo’s intersection, Princeton

Page 100: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ABACADBABCBDDADBDCEAEBECED

turns

Page 101: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

Page 102: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

JoJo’s intersection, Princeton, USA (allowed a right turn against the lights)

Page 103: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

ED

EA

BC

EC

EB

DC

DA

BA

AD

AC

DB

AB

BD

Page 104: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

ED

EA

BC

EC

EB

DC

DA

BA

AD

AC

DB

AB

BD

JoJo’s intersection, Princeton, USA (allowed a right turn against the lights)

Page 105: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

ED

EA

BC

EC

EB

DC

DA

BA

AD

AC

DB

AB

BD

Page 106: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

ED

EA

BC

EC

EB

DC

DA

BA

AD

AC

DB

AB

BD

4 colours4 steps

Page 107: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is

B

C

A

E

D

JoJo’s intersection, Princeton

ED

EC

EB

EA

DC

DB

DA

BD

BC

BA

AD

AC

AB

EDECEBEADCDBDABDBCBAADACAB

1111

11111

111

111

11111

11111

11

111

11111

1111

ED

EA

BC

EC

EB

DC

DA

BA

AD

AC

DB

AB

BD

4 colours4 steps

4-clique!

Page 108: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is
Page 109: Algorithms and Data Structures TEACH THAT Algorithms and Data Structures An algorithm does something, solves some problem, in a mechanical way. It is