Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design and Analysis of Algorithms (DAA) 3621511 (6 cp) Pasi Fränti 7.9.2015.

Similar presentations


Presentation on theme: "Design and Analysis of Algorithms (DAA) 3621511 (6 cp) Pasi Fränti 7.9.2015."— Presentation transcript:

1 Design and Analysis of Algorithms (DAA) 3621511 (6 cp) Pasi Fränti 7.9.2015

2 2 DAA course at Autumn 2015 Web: http://cs.uef.fi/pages/franti/asa/http://cs.uef.fi/pages/franti/asa/ ETCS 6 (=richer content) Lectures (34h): - Mon 14-17 - Tue 14-16 Exercises (16h): - Fri 10-12 Exam dates: 6.11. 27.11.

3 3 Motivation Design -90% cases simple algorithms found from Bachelor level courses -Focus on the 10% tough ones Analysis – Why not just measure processing time? – Time vs. space complexity analyses – Upper and lower limits

4 4 Key concepts Problem -Can the problem be solved? -How difficult is the problem? -Real-life problems to algorithmic problems Algorithm – How to find suitable algorithm? – How to make it efficient? Instance – Upper and lower limits

5 136 170 315 14878 231 234 120 89 131 109 116 86 246 182 216 110 117 199 121 142 242 79 191 178 191 126 149 170 51 112 90 163 59 143 73 63 53 27 135 105 58 116 72 79 Graph problems Coloring problem Shortest path Traveling salesman

6 6 Clustering problem InputOutput

7 7 We need a well-specified problem that tells what needs to be achieved Algorithm solves the problem It consists of a sequence of commands that takes an input and gives output What is algorithm? Algorithm Input Output

8 8 Non-solvable problems Give list of all rational numbers in [0..1] Longest sequence of  without the 0 digit Stopping problem AB Any algorithm Solve Stopping TRUE FALSE Does algorithm A stop always?

9 9 Non-solvable problems Give list of all rational numbers in [0..1] Longest sequence of  without the 0 digit Stopping problem AB Any algorithm Solve Stopping TRUE FALSE C Eternal loop Algorithm “Vice Versa” Stop Algorithm C NOT stop always!

10 Algorithm principles Sequence -One command at a time -Parallel and distributed computing Condition -IF -CASE Loops -FOR -WHILE -REPEAT

11 11 Time complexity: – How much time it takes to compute – Measured by a function T(N) Space complexity: – How much memory it takes to compute – Measured by a function S(N) Complexity

12 12 Time complexity N = Size of the input T(N) = Time complexity function Order of magnitude: – How rapidly T(N) grows when N grows – For example: O(N) O(logN) O(N²) O(2N)

13 13 Examples: Bubble sort (N²), Quicksort (N∙logN) Asymptotic analysis log N --- sub-linear 2 N --- exponential N² --- quadratic N --- linear N 3 --- cubic N logN

14 14 Processing power increases → f(N)f(N)T(N) = 1,000T(N)=10,000Growth rate 100NN = 10N=10010 x 5N²5N² 14443.1 x ½N³½N³ 12272.3 x 2N2N 9131.4 x logN2 1,000 2 10,000 Very high!! Problem size vs. processing time

15 15 Exponential time complexity 1248163264 128 512256 1k2k 2 64 = 18.4 ∙ 10 18 1M 1G … 1T 1P 1E Halfway…? Large than Everest

16 Graph algorithms

17

18


Download ppt "Design and Analysis of Algorithms (DAA) 3621511 (6 cp) Pasi Fränti 7.9.2015."

Similar presentations


Ads by Google