Intro To Data Structures and Algorithms
Intro To Data Structures and Algorithms
Luciano Bononi
bononi@cs.unibo.it
http://www.cs.unibo.it/~bononi/
Lessons
$onday -.((.)/.((
0riday -.((.)/.((
3o tal4 "ith me
http!!""".cs.unibo.it!#bononi!
:ill find
General information
Lesson slides
e;ercises
:ritten e;am
Hral e;am
...
Data Structures and Algorithms 12
:hy "eJre studying algorithms=
Data Structures and Algorithms 13
:hy :EJre studying algorithms=
0olding@Dome
http!!en."i4ipedia.org!"i4i!FroteinOfolding
Data Structures and Algorithms 14
Algorithms again=
=
1
5
2
1.618
=
1
5
2
0.618
Data Structures and Algorithms 19
3he trivial 0ibonacci algorithm
,n seconds=
T,)- . T,+- . )K
i =(
k )
'
i
...
'
n/ '
'
n/'
)
')
'
n/ '
:e e;ploit the fact that
31n2 is monotone
increasing
<ecursion ends
"hen 4>n!'
Data Structures and Algorithms 28
Can "e do it better=
1 1
1 0
A
n1
=
1 1
1 0
n1
=
F
n
F
n1
F
n1
F
n2
1 1
1 0
1 0
0 1