Download presentation

Presentation is loading. Please wait.

Published byEdgar McConnell Modified over 2 years ago

1
Greed is Good But gluttony is a deadly sin

2
What are greedy algorithms? Why they are useful Dangers of using greedy algorithms

3
Prim’s Algorithm

4
1 2 5 3 a dc b

5
1 2 3 a dc b Minimum Spanning Tree

6
bc adf e 44 3 1 55 86 2 6 PQ: (a,b,3) ; (a,f,5) ; (a,e,6)

7
bc adf e 44 3 1 55 86 2 6 PQ: (b,c,1) ; (b,f,4) ; (a,f,5) ; (a,e,6)

8
bc adf e 44 3 1 55 86 2 6 PQ: (c,f,4) ; (b,f,4) ; (a,f,5) ; (a,e,6) ; (c,d,6)

9
bc adf e 44 3 1 55 86 2 6 PQ: (f,e,2) ; (b,f,4) ; (a,f,5) ; (f,d,5) ; (a,e,6) ; (c,d,6)

10
bc adf e 4 4 3 1 55 86 2 6 PQ: (b,f,4) ; (a,f,5) ; (f,d,5) ; (a,e,6) ; (c,d,6) ; (e,d,8)

11
bc adf e 4 4 3 1 55 86 2 6

14
Kruskal’s Algorithm

15
bc adf e 44 3 1 55 86 2 6 Sorted list: (b,c,1) ; (e,f,2) ; (a,b,3) ; (c,f,4) ; (b,f,4) ; (a,f,5) ; (d,f,5) ; (a,e,6) ; (c,d,6) ; (d,e,8)

16
bc adf e 44 3 1 55 86 2 6

17
bc adf e 44 3 1 55 86 2 6

18
bc adf e 44 3 1 55 86 2 6

19
bc adf e 44 3 1 55 86 2 6

20
bc adf e 44 3 1 55 86 2 6

21
DONE!! DANKEI THAKN YOU! Nou kan jy aangaan met jou lewe…

Similar presentations

OK

Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.

Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on unity in diversity images Ppt on collection of primary data Ppt on conservation of natural resources Ppt on male reproductive system Ppt on two point perspective examples Ppt on db2 mainframes cics Ppt on old age problems Ppt on sbi home loan Ppt on business development planning Ppt on file system implementation