Vous êtes sur la page 1sur 168

MAJEURE D’INFORMATIQUE

Promotion 2004 Année 3 Majeure 2

INF551

Conception et analyse d’algorithmes

Robert Cori, Guillaume Hanrot Claire Kenyon, Jean-Marc Steyaert

Édition 2007

 b = 0 b

 k

=

10000

n ′ /n
f ( n) n n ′
10
n
n ′ = 10 n
20
n
n ′ = 10 n
5 n log n
√ 10 n ≤ n ′ ≤ 10 n
2
n 2
√ 10n
n ′ =
n
2
n ′ = n + 3

=

G = (X, E )

X E

n m

X A

( X, A) a A a¯

a a { a, a¯ }

e 1 , e 2 ,

, e k

x 1 , x 2 ,

, x k , x k +1 e i = { x i , x i+1 }

x 1 x k +1 k

x 1 , x 2 ,

, x k

x 1 = x k +1

x, y X x y

n

m = n 1

G = (X, T )

G = (X, T )

G = (X,

T ) X = | T | + 1

G = (X, T ) X = | T | + 1

G = (X, T )

G = (X, E )

X

G

n

n n 2

G = (X, E ) A = (X, T ) G

G T T

m n + 1 m n + 1

S X S

( x S y S ) ⇒ { x, y } ∈/ E.

Y X

Y

{ x, y } ∈ E ( x Y y Y )

C E C

e, f

C e f =

k c X

{ 1 , 2 ,

, k }

{ x, y } ∈ E c ( x) = y ) .

k k G

G

E e E

v ( e)

C E

F E

e F v ( e) F C

C F C

F

F F =

F

C

E e E

d ( e) f ( e) > d ( e) v ( e)

e E 1 F

e 1 , e 2 ,

e 1 F e 2 F [d ( e 1 ) , f ( e 1 )] [d ( e 2 ) , f ( e 2 )] = .

E

E e 1 , e 2 ,

F :=

, e n f ( e 1 ) f ( e 2 )

f ( e n )

i 1 n e i F

F

F = { x 1 , x 2 ,

, x p } G = { y 1 , y 2 ,

, y q } , q p F G G

F x i y j

p = q k x k = y k i < k

x i = y i F f ( y k ) f ( x k ) G

G = { y 1 , y 2 ,

y k 1 , x k , y k +1 , y q }

G G

F G

H G F H

F F

p = q

e 1 , e 2 , e 3

e 1 e 2
e 3
d
f

e 1 e 2
e 3 e 4
d
f

5
6
1
2
3
4
3
4
5
4
4
5
4
6
7
2 5
6
7
6
8
6
8
9 10
6 9
7
10
7
11

v ( e) e v ( T ) T

E C F

F

F :=

e 1 , e 2 ,

v ( e 1 ) v ( e 2 )

, e n

v ( e n )

i 1 n e i F

F

G T G

a G T T

{ 4 , 7 } 1 , 3 , 4 , 7

1
2
3
6
7
4
5

T U G a

U T b γ a T

U \ { a} ∪ { b} G

a U

U 1 U 2 γ a T

a

T b

T

T U T

a U T b

T a

T

v ( a) b v ( b) v ( a) v ( U − { a} ∪ { b} ) v ( U ) > v ( T )

U − { a} ∪ { b}

U

T U

E F E

F ∈ F F F F ∈ F

v E

F ∈ F v ( F ) = e F v ( e)

E v ( e)

e 1 , e 2 ,

F :=

v ( e 1 ) v ( e 2 ) ,

v ( e n )

e n

i 1 n e i F F ∪ { e i } ∈ F

v ( e)

v e, v ( e) = 1

F

v ( e)

v F

F G F G F

x G F F ∪ { x} ∈ F

F G

v F

p F G q F

G v

 f F v ( f ) = 2 q + 2 g G F v ( g ) = 2 q + 1

h F G v ( h) = 0

F

F F

v ( F ) = (p + q )(2 q + 2) v ( G ) = p (2 q + 2) + (q + 1)(2 q + 1) v ( G ) = v ( F ) + q + 1

F F

G F F

F

G x

F E

F ∈ F , F F, F ∈ F

F G F G F

x G \ F F ∪ { x} ∈ F

F

F G

F

p G F

v ( F ) v ( G )

p = 0 p > 0 x F x / G F G

G

x

G y G F v ( y ) v ( x)

F = ( F G ) ∪ { x}

F F

G G

G F x G

G G = G ∪ { x} \ { y } v ( G ) = v ( G ) + v ( x) v ( y ) v ( G ) .

G F G

v ( F ) v ( G ) v ( G )

E

M = (E, F ) E F

E

| F | F

F E

 F ′ ⊂ F F ∈ F ⇒ F ′ ∈ F F, G ∈ F , | G | > | F | ⇒ ∃x ∈ G \ F, F ∪ { x} ∈ F

F

M

E

K F

E

F = { u 1 , u 2 ,

, u k } G = { v 1 , v 2 ,

, v k , v k +1 }

v i u j G

k k + 1

v i u j F ∪ { v i } ∈ F

Γ = (X, E )

E

E

F = F i i = 1 ,

, p X i

X

G F E G

F = F i G G = G i G G i G

X i G

X i G

G i F i X i , G i

| G | = | F | + 1 | G | = | G i | + | G | | G | > 0

G = (X, E ) X

Y Z e E

Y Z

F E F

Y

Y Z

M

M

A = A 1 , A 2 ,

, A k

E A T = { x 1 , x 2

, x l }

E i 1 , i 2 ,

, i l x j A i j

E = { 1 , 2 , 3 , 4 , 5 , 6 }

A 1 =

{ 1 , 3 , 4 } , A 2 = { 3 , 5 , 6 } , A 3 = { 1 , 4 } , A 4 = { 2 , 5 } , A 5 = { 3 , 4 } , A 6 = { 1 , 3 }

E 2 , 5

6

S

E

A 1 A 2

A 3 A 4

T 1 , T 2 ,

, T k

T i d i

T i d i p i

T i

T 1 ,

, T 7

T 1 T 2 T 3 T 4 T 5 T 6 T 7
d
p

T 1 T 2 T 3 T 4 T 5 T 6 T 7 T 3

T 4 T 6 T 7 90+50+40+20 = 200

T 3 T 4 T 2 T 5 T 7 T 1 T 6 T 1 T 6

T 4 T 3 T 2 T 1 T 7 T 5 T 6

F F T = { T 1 , T 2 ,

, T k }

F ∈ F F

U ( i, F ) i

E

M = (E, F ) M F

B M B

B ∈ F , B F, F ∈ F

B = F

B M

( Ba)

B 1 , B 2 ∈ B , x B 1 \ B 2 , ⇒ ∃y B 2 \ B 1

( B 1 y ) \ x ∈ B

B ( Ba) F F E

B ∈ B F B ( I 1), ( I 2), ( I 3)

F

M M

F C M C

C

/ F ,

F C, F = C F ∈ F

C M

C 1 C 2 C C 1 C 2

C 1 C 2

C 3 ( C 1 C 2 ) \ x

C

x C 1 C 2

C 3

C E

F

F

M E

E F

M ρ M A A E ρ( A)

F F A

ρ( A) =

max F | F |

F A,F

ρ E N

M

ρ( ) = 0 , A B

ρ( A) ρ( B )

ρ( A ∪ { x} ) = ρ( A ∪ { y } ) = ρ( A) ρ( A ∪ { x, y } ) = ρ( A)

G

A E n c n

c

X A

A

G X

u v E G = (X, E, u, v )

u v

u v

G = (X, E, u, v ) G 1 = (X, E , u, v ) E = E

{ u, v } G G 1 G

G 1 G

G 1 G

u
v
G 1
u
v

G 2

u
v
G
3

G 1 G 2 G 3

G u v

A 1 = (Y, T 1 ) A 2 = (Y, T 2 )

Y X, T 1 E, T 2 E, T 1 T 2 = , u, v Y

e G = (X, E ) G e

X e = { x, y }

G G e G e

y { y, z } y { x, z }

x z G x y

1
2
3
6
7
4
5

Suppression de {4.7}

1
2
3
6
7
4
5
de {4,7}

Contraction

1
2
3
6
7
5

T 1 T 2

e G e

T 1 T 2

T 1 Y 1 Y 2

T 1 f T 2 Y 1

Y 2 f

T 2 T 1

T 2

T 1 T 2 u v

G = (X, A) X

A or ext a

A A

( a) a

x 0 x i X

x 0 x i

x 2

x 0 f x 0 x

a

x 0 ext( a)

d

d x d [x]

x 0

x d

℄℄ ℄℄

℄℄ ℄℄

℄℄

d d [x 0 ] = 0 x = x 0 d [x] =

d [x] x

x d [x]

d [x]

x
x
2
3
x 1
x
4
x
5
x 7
x
6

x 2

n m n

m d log n

O ( n log n + m log n)

x

d [x] =

x

n n 1

x 0

i

i

℄℄ ℄℄

x
x
2
3
x 1
x
4
x
5
x 7
x
6

x 1

x 2 , x 3 , x 4 , x 5 , x 6 , x 7

O ( nm)

x 0

x i x j δ ( x i , x j )

δ ( x i , x j ) = x i x j

δ

( i, j ) a x i

x j ( i, j ) =

f x y z

x z

z y

x 1 , x 2 ,

x n k > 0

P k f

P k ( f ) f

k

P 1

P n +1

δ k ( x i , x j ) P k x i

x j δ 1 ( x i , x j ) =

x i x j ( a) a δ n +1 = δ

δ k +1 δ k ( x i , x j )

δ