Corina Dima corina.dima@uni-tuebingen.de
Department of General and Computational Linguistics
Analysis of Algorithms Data Structures and Algorithms for CL III, WS - - PowerPoint PPT Presentation
Department of General and Computational Linguistics Analysis of Algorithms Data Structures and Algorithms for CL III, WS 2019-2020 Corina Dima corina.dima@uni-tuebingen.de M ICHAEL G OODRICH Data Structures & Algorithms in Python R OBERTO T
Department of General and Computational Linguistics
Analysis of Algorithms | 2
Analysis of Algorithms | 3
Analysis of Algorithms | 4
Analysis of Algorithms | 5
Analysis of Algorithms | 6
20 40 60 80 100 120
Running Time
1000 2000 3000 4000
Input Size best case average case worst case
Analysis of Algorithms | 7
1000 2000 3000 4000 5000 6000 7000 8000 9000 50 100
Input Size Time (ms)
Analysis of Algorithms | 8
Analysis of Algorithms | 9
Analysis of Algorithms | 10
Analysis of Algorithms | 11
Analysis of Algorithms | 12
Analysis of Algorithms | 13
Analysis of Algorithms | 14
Analysis of Algorithms | 15
Analysis of Algorithms | 16
Analysis of Algorithms | 17
Analysis of Algorithms | 18
Analysis of Algorithms | 19
Analysis of Algorithms | 20
Analysis of Algorithms | 21
Analysis of Algorithms | 22
'() *
Analysis of Algorithms | 23
'() *
Analysis of Algorithms | 24
'() *
Analysis of Algorithms | 25
Analysis of Algorithms | 26
/01
Analysis of Algorithms | 27
/01
Analysis of Algorithms | 28
Analysis of Algorithms | 29
1 100 1⋅104 1⋅106 1⋅108 1⋅1010 1⋅1012 1⋅10-6 1⋅10-4 0.01 100 1⋅104 1⋅106 1⋅108 1⋅1010 1⋅1012 1⋅1014 1⋅1016 1⋅1018 1⋅1020 1⋅1022 1⋅1024 1⋅1026 1⋅1028 1⋅1030
f(n) = n linear f(n) = n log n linearithmic f(n) = n2 quadratic f(n) = 1 constant f(n)=log n f(n) = n3 cubic f(n)=2ⁿ exponential
Analysis of Algorithms | 30
Analysis of Algorithms | 31
Analysis of Algorithms | 32
Analysis of Algorithms | 33
Analysis of Algorithms | 34
Analysis of Algorithms | 35
Analysis of Algorithms | 36
10-60 10-50 10-40 10-30 10-20 10-10 100 1010 1020 1030 1040 1050 1060 10-30 10-20 10-10 100 1010 1020 1030
y = x2 y = 2x2+7 y=x y = 3x+1
Analysis of Algorithms | 37
1 10 100 1,000 10,000 1 10 100 1,000
3n 2n+10 n
345
Analysis of Algorithms | 38
1 10 100 1,000 10,000 1 10 100 1,000
3n 2n+10 n
Analysis of Algorithms | 39
Analysis of Algorithms | 40
1 10 100 1,000 10,000 100,000 1,000,000 1 10 100 1,000
n^2 100n 10n n
Analysis of Algorithms | 41
1 10 100 1,000 10,000 100,000 1,000,000 1 10 100 1,000
n^2 100n 10n n
Analysis of Algorithms | 42
Analysis of Algorithms | 43
Analysis of Algorithms | 44
Analysis of Algorithms | 45
Analysis of Algorithms | 46
1
Analysis of Algorithms | 47
Analysis of Algorithms | 48
Analysis of Algorithms | 49
Analysis of Algorithms | 50
Analysis of Algorithms | 51
Analysis of Algorithms | 52
Analysis of Algorithms | 53
Analysis of Algorithms | 54
Analysis of Algorithms | 55
Analysis of Algorithms | 56
Analysis of Algorithms | 57
Analysis of Algorithms | 58
Analysis of Algorithms | 59
Analysis of Algorithms | 60
Analysis of Algorithms | 61
Analysis of Algorithms | 62
Analysis of Algorithms | 63
Analysis of Algorithms | 64
Analysis of Algorithms | 65
Analysis of Algorithms | 66
Analysis of Algorithms | 67
Analysis of Algorithms | 68
Analysis of Algorithms | 69
Analysis of Algorithms | 70
Analysis of Algorithms | 71
Analysis of Algorithms | 72
Analysis of Algorithms | 73
Analysis of Algorithms | 74
§ 2'3 − 1 − *+, + 1 =
89:;<=>< ?
− low ≤
<=>< B89:;C ?
§ ℎ'(ℎ − 2'3 + 1 + 1 = high −
89:;<=>< ?
≤
<=>< B89:;C ? Analysis of Algorithms | 75
$ = # $&
' = # $(
$)
$* < 1, therefore - > log$!
Analysis of Algorithms | 76
Analysis of Algorithms | 77
bra2/x2ec2f6f830c9fb89:logs
Analysis of Algorithms | 78
* + = log% & − log% '
/012 %