of 11 /11
30 1: 1.4: !" # \$% T(n)=aT(n/b)+f(n) &#’( )*( &#’( )*( ! "#\$%&’"#\$()%*+#\$% !"#\$%&’(\$%)* + , -(%.(’/%0 + 1 21 3 4 56#78\$56#9:7;<6#7 = > ?2 + = 1 =@A B . +,( ’ #’( ’,\$ ’ #’( -!: ! "#\$%&’"#\$()%*+#\$% +!+- - \$!( ’ -+! ’( #( \$%( T(n)=aT(n/b)+f(n) +!+- . %( -+/( ’ -+! ’( #( \$%( T(n)=aT(n/b)+f(n) +!+- ,( ’0,( MergeSort ,( 1#’( BinarySearch .. -"! 1. ! , ! "#\$%&’"#\$()%*+#\$% -,’- %( ,( ,( -! %( ,( +!( +-!’ +, ! # !. +-!’ +, ! # ! . # %-’ ! + ’ ’ - ’( -’%-#( ’( -! ’ -’, ’( . -# 2# -,( * 2!-’ ’ \$#. ’#’- ,’ - + -! ’ ’( ’( !( +%+- !-’ # ’ ! ’ ’: procedure recursive(n) ... ... --’#- * +-!2( *( ,(: BinarySearch ’ 1#’ ’\$-! - ! ! MergeSort ’ ’0, -,( +! ... recursive(n-1) ... ... end procedure

Embed Size (px)

Transcript of ΠΛΗ30 ΜΑΘΗΜΑ 1.4

30

1:

1.4:

!"

# \$% T(n)=aT(n/b)+f(n)

&#'( )*(&#'( )*(

!"#\$%&'"#\$()%*+#\$%

!"#\$%&'(\$%)*

+ , -(%.('/%0

+ 121

3

4 56#78\$56#9:7;<6#7

= > ? 2

+ = 1= @A+ = 1= @A

B

. +,( ' #'(

',\$ ' #'( -!:

!"#\$%&'"#\$()%*+#\$%

+!+-

- \$!( ' -+! '( #( \$%(

T(n)=aT(n/b)+f(n)

+!+- .

%( -+/( ' -+! '( #( \$%(

T(n)=aT(n/b)+f(n)

+!+- +!+-

,( '0,( MergeSort

,( 1#'( BinarySearch

.. -"!1. ! ,

!"#\$%&'"#\$()%*+#\$%

-,'- %( ,( ,( -! %( ,( +!(

+-!' +, ! # !.+-!' +, ! # !.

# % -' ! + ' ' - '( -'%-#(

'( -! ' -', '(.

-# 2# -,( * 2!-' ' \$#.

'#'- ,' - + -! ' '( '( !( +%+-

!-' # ' ! ' ':

procedure recursive(n)

...

...

--'#- * +-!2( *( ,(:

BinarySearch ' 1#' '\$-! - ! !

MergeSort ' '0, -,( +!

...

recursive(n-1)

...

...

end procedure

.. -"!1. ! ,1. ,( 1#'( BinarySearch (1.&'*+" -' !)

, !"#\$%&'"#\$()%*+#\$%

BinarySearch # &# 1#':

!(: 0,%( +!( A, '\$-! x !(: 0,%( +!( A, '\$-! x

30(:

' '\$-! +\$- ' +!, -+'%2-' % '

'\$-! x ' +! .

' '\$-! - +\$- ' +!, -+'%2-' 0.

-' ! ' !: ,( -0-'1- ' -! '\$-! '

+! !- +-+'-(:+! !- +-+'-(:

' -! '\$-! -! ' x, -+'%2- ' % '.

' x -! ,'- +, ' -! '\$-! ','- /\$-

' ' ' +! +, ' \$# %\$ ' -! '\$-!

' x -! - *'- +, ' -! '\$-! ','- /\$-

' ' ' +! +, ' -! '\$-! %\$ ' '%(

.. -"!1. ! ,1. ,( 1#'( BinarySearch (2. )-()

- !"#\$%&'"#\$()%*+#\$%

'" 2!-' ! +! '( BinarySearch - /-

procedure BinarySearch(A,x,start,finish)procedure BinarySearch(A,x,start,finish)

if start>finish then return 0

else

middle=(start+finish) div 2if (x==A[middle]) then

return middleelse if (x<A[middle]) then

pos=BinarySearch(A,x,start,middle-1)return posreturn pos

else if (x>middle) then

pos=BinarySearch(A,x,middle+1,finish)return pos

end if

end if

end procedure

.. -"!1. ! ,1. ,( 1#'( BinarySearch (3. - '%-()

. !"#\$%&'"#\$()%*+#\$%

'-*- ' , /\$'( ' '\$-! 11 ' +!:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

4#: BinarySearch(A,11,1,15): middle=(1+15) div 2=8. x<A[middle]

# 4#: BinarySearch(A,11,1,7) : middle=(1+7) div 2=4 x>A[middle]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

2 3 5 7 11 13 17 21 23 27 31 33 37 41 43

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

2 3 5 7 11 13 17 21 23 27 31 33 37 41 43

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

2 3 5 7 11 13 17 21 23 27 31 33 37 41 43

start

start

finish

finish

# 4#: BinarySearch(A,11,5,7) : middle=(5+7) div 2=6 x<A[middle]

# 4#: BinarySearch(A,11,5,5) : middle=(5+5) div 2=5 x=A[middle]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

2 3 5 7 11 13 17 21 23 27 31 33 37 41 43

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

2 3 5 7 11 13 17 21 23 27 31 33 37 41 43

start

start

start=finish

finish

finish

.. -"!1. ! ,1. ,( 1#'( BinarySearch (4. )

/ !"#\$%&'"#\$()%*+#\$%

4*'- +-!+'": -! ,' ' '\$-! x 5!-' 5( '

-! % ' +!. -! % ' +!.

++,'' -! T(n)=5 +'"' T(n)=(1).

6-,'- +-!+'": -! ,' ' '\$-! x - +\$- ' +!:

3'" T(n) ++,'' ,' +!( %\$- ' n.

\$ ! 8 +0-( %\$ !- # #

(%'" ,' +' !-' 2 # # %\$- !

++" * )

3+-' !-' # # +! '( 1−

n

3+-' !-' # # +! '(

7 2* ' n, %\$- \$, T(n), '

%- \$,

3+-' !-' , 1 +0.

7 ++,'' !-' +, ' # \$%:

,' n=0 ','- !-' 1 +0 ('# '-'*)

12

n

12

n

1

2

nT

912

)( +

=

nTnT

.. -"!1. ! ,1. ,( 1#'( BinarySearch (4. )

0 !"#\$%&'"#\$()%*+#\$%

- \$-,'- +-!+'" *-' +, ' # \$%:

= 0,1 n

+-# "', '# \$% -! !'- +-!+ ' *-,

' +- !1- "( -0#(:

-! +-!+

7 +*+'- '-# # \$%:

>+

=

=0,91

2

0,1

)(n

nT

n

nT

12

n

2

n

7 +*+'- '-# # \$%:

+! *- - ' - \$!( +*+'- ,'

++,'' '( -!:

>+

=

=0,9

2

0,1

)(n

nT

n

nT

)(log)( nnT Θ=

.. -"!1. ! ,2. ,( '0,( MergeSort (1.&'*+" -' !)

!"#\$%&'"#\$()%*+#\$%

MergeSort # 0, - \$-:

!(: +!( () A - n '\$-! !(: +!( () A - n '\$-!

30(: '0, '" '\$-!" ' +! - *0 -

-' ! ' !: ,(:

0-! ' '-, ' ' +!

0-! ' -0! ' ' +!

\$"-*- ' * '0% +% ' - ! '0%

!!

'0, - '* !-' - # # '( !(

!(.

.. -"!1. ! ,2. ,( '0,( MergeSort (2. )-()

!"#\$%&'"#\$()%*+#\$%

'" 2!-' ! +! '( MergeSort - /-

procedure MergeSort(A,start, finish)procedure MergeSort(A,start, finish)

if |A|<=2 then

else

middle=(start+finish) div 2A1=MergeSort(A,start,middle)A2=MergeSort(A,middle+1,finish)A=Merge(A1,A2)

end if

'# '-'* '( #( -! ,' +!( %\$- ' +* 2 '\$-!.

!' 2 %( #-( ' '0, ' '-* '-0* '* '!'\$.

3+-' !-' \$- '" * - ' ! Merge

end procedure

.. -"!1. ! ,2. ,( '0,( MergeSort (2. )-()

!"#\$%&'"#\$()%*+#\$%

! Merge ' \$- * # '0%" +"

+-! +-! "( -0#(:+-! +-! "( -0#(:

procedure Merge(A,)

i=1, j=1, k=1while (i<=n AND j<=m)

if (ai<bj) thenck=ai ; i=i+1

else

ck=bj ; j=j+1end if

+" -"*- ' ||=n, |B|=m

k=k+1end while

B Creturn C

end procedure

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# MergeSort(,1,16)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 9 10 13

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# MergeSort(,1,16)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

, !"#\$%&'"#\$()%*+#\$%

# 4# (A,1,8)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

18 7 4 11

5 6 7 8

9 20 6 118 7 4 11 9 20 6 1

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

- !"#\$%&'"#\$()%*+#\$%

# 4# (A,1,4)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

18 7 4 11

5 6 7 8

9 20 6 118 7 4 11 9 20 6 1

1 2

18 7

3 4

4 11

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

. !"#\$%&'"#\$()%*+#\$%

# 4# (A,1,2): 0 ' ++!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

18 7 4 11

5 6 7 8

9 20 6 118 7 4 11 9 20 6 1

1 2

7 18

3 4

4 11

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

/ !"#\$%&'"#\$()%*+#\$%

# 4# (A,3,4): 0 ' ++!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

18 7 4 11

5 6 7 8

9 20 6 118 7 4 11 9 20 6 1

1 2

7 18

3 4

4 11

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

0 !"#\$%&'"#\$()%*+#\$%

# 4# (A,1,4): \$- '" * ++"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

9 20 6 14 7 11 18 9 20 6 1

1 2

7 18

3 4

4 11

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# (A,5,8)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

9 20 6 14 7 11 18 9 20 6 1

1 2

7 18

3 4

4 11

5 6

9 20

7 8

6 1

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# (A,5,6): 0 ' ++!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

9 20 6 14 7 11 18 9 20 6 1

1 2

7 18

3 4

4 11

5 6

9 20

7 8

6 1

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# (A,7,8): 0 ' ++!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

9 20 6 14 7 11 18 9 20 6 1

1 2

7 18

3 4

4 11

5 6

9 20

7 8

1 6

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# (A,5,8): \$- '" * ++"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

18 7 4 11 9 20 6 1

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

1 6 9 204 7 11 18 1 6 9 20

1 2

7 18

3 4

4 11

5 6

9 20

7 8

1 6

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

!"#\$%&'"#\$()%*+#\$%

# 4# (A,1,8): \$- '" * ++"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

1 4 6 7 9 11 18 20

9 10 11 12 13 14 15 16

22 19 14 5 2 3 10 13

1 2 3 4

4 7 11 18

5 6 7 8

1 6 9 204 7 11 18 1 6 9 20

1 2

7 18

3 4

4 11

5 6

9 20

7 8

1 6

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

, !"#\$%&'"#\$()%*+#\$%

'!'\$ ! ,-( %( #-( ' (9,16)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

18 7 4 11 9 20 6 1 22 19 14 5 2 3 10 13

1 2 3 4 5 6 7 8

1 4 6 7 9 11 18 20

9 10 11 12 13 14 15 16

2 3 5 10 13 14 19 22

1 2 3 4

4 7 11 18

5 6 7 8

1 6 9 20

9 10 11 12

5 14 19 22

13 14 15 16

2 3 10 134 7 11 18 1 6 9 20

1 2

7 18

3 4

4 11

5 6

9 20

7 8

1 6

5 14 19 22 2 3 10 13

9 10

19 22

11 12

5 14

13 14

2 3

15 16

10 13

.. -"!1. ! ,2. ,( '0,( MergeSort (3. - '%-()

- !"#\$%&'"#\$()%*+#\$%

# 4# (A,1,16): \$- '" * ++"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

1 2 3 4 5 6 7 9 10 11 13 14 18 19 20 22

1 2 3 4 5 6 7 8

1 4 6 7 9 11 18 20

9 10 11 12 13 14 15 16

2 3 5 10 13 14 19 22

1 2 3 4

4 7 11 18

5 6 7 8

1 6 9 20

9 10 11 12

5 14 19 22

13 14 15 16

2 3 10 134 7 11 18 1 6 9 20

1 2

7 18

3 4

4 11

5 6

9 20

7 8

1 6

5 14 19 22 2 3 10 13

9 10

19 22

11 12

5 14

13 14

2 3

15 16

10 13

.. -"!1. ! ,2. ,( '0,( MergeSort (4. )

. !"#\$%&'"#\$()%*+#\$%

++,'' '( '( Merge -!:

)()( mnnT +Θ=

7 ++,'' '( MergeSort -!:

+! -! !'- +-!+ 8', -"*- ,'

>Θ+

+

==Θ

=2),(

22

21),1(

)(nn

nT

nT

nn

nT

nnn≈

=

)()( mnnT +Θ=

+! -! !'- +-!+ 8', -"*- ,'

7 ++-!' "(:

+! *-' +, ' .4\$!( +*+'-: (n)=(nlogn)

222

nnn≈

=

>Θ+

==Θ

=2),(

22

21),1(

)(nn

nT

nn

nT

. - ! #-"1. # T(n)=aT(n/b)+f(n)

/ !"#\$%&'"#\$()%*+#\$%

' -+! '( #( \$%( T(n)=aT(n/b)+f(n) +\$ *',+:',+:

- \$!(, ' +! - -* ',+ ( !- +'"'# -'! '( ++,''(

%( -+/(, ( !- ' 5# '++,''( ( +*- -0 - +'"'#-'!).

-+(:

( 1'-!' + * '( #(, +'- ' -\$!(.\$!(.

( 1'-!' 5#( ' ++,''( +'-!' %( -+/(

( 1'-!' +'"'# -'! '( '( ++,''(+'- ' - \$!(

' - \$!( +'*\$- (+-! 5-! ' 2 #'( 3( +-!+'"( ' .4.) ','- ' \$+*- '% -+/(.

. - ! #-"1. # T(n)=aT(n/b)+f(n)1. +! - ' - \$!(

0 !"#\$%&'"#\$()%*+#\$%

- 4\$!( (Master Theorem) -! ' -0#(:

: 3'" # -0!" : 3'" # -0!"

,+ a91, b>1 -! '-%(, f(n) -! +'"' -'# '.

,'- !' ,-( '-( +-+'-(:

) + '- ->0, ','-:)()(log ε−

=abnOnf

)()( nfb

naTnT +

=

( )abnnTlog

)( Θ=

.) ','-:

) + '- ->0

+ '- c<1, ','-:

)()(log abnnf Θ=

( )nnnTab log)(

log⋅Θ=

)()(log ε+

Ω=abnnf

)(nfcb

nfa ⋅≤

( ))()( nfnT Θ=

. - ! #-"1. # T(n)=aT(n/b)+f(n)1. +! - ' - \$!(

!"#\$%&'"#\$()%*+#\$%

' -+! - ' - '( \$!( - 1,'- "( -0#(:

'+!1- +, ' -2 ' a,b f(n) '+!1- +, ' -2 ' a,b f(n)

+, !1- ' logba.

!- +'"' ' f(n) - ' :

-!'- ' ’ +-!+'"

-!'- ' B’ +-!+'"

abnnflog

)( <

abnnflog

)( =

abnlog

-!'- ' ’ +-!+'" (6! :' +%+-

-% 0- ' 2 #)

abnnflog

)( >

. - ! #-"1. # T(n)=aT(n/b)+f(n)1. +! - ' - \$!( (’ +-!+'")

!"#\$%&'"#\$()%*+#\$%

2, -!'- ' ’ +-!+'" '+- '- ' +,-0

*2" - ' ,:*2" - ' ,:

:

*-'- ' #:

:

3\$":

\$*-: + '- ->0

7 +, ' ’ +-!+'" ' -"#'( 4\$!( %+-' ,':

nn

TnT +

=

28)(

)()( 3 ε−== nOnnf

)()( 3nnT Θ=

38loglog,)(,2,8 2 ===== annfba b

)()( 3nnT Θ=

. - ! #-"1. # T(n)=aT(n/b)+f(n)1. +! - ' - \$!( (.’ +-!+'")

!"#\$%&'"#\$()%*+#\$%

2, -!'- ' .’ +-!+'" '+- '- ' +,-0

*2" - ' ,:*2" - ' ,:

:

*-'- ' #:

:

3\$":

\$*-:

7 +, ' .’ +-!+'" ' -"#'( 4\$!( %+-' ,':

2

39)( n

nTnT +

=

)()( 22 nnnf Θ==

)log()( 2 nnnT Θ=

29loglog,)(,3,9 3

2===== annfba b

)log()( 2 nnnT Θ=

. - ! #-"1. # T(n)=aT(n/b)+f(n)1. +! - ' - \$!( (’ +-!+'")

!"#\$%&'"#\$()%*+#\$%

' ’ +-!+'" +%+- -% 0- ' 2 #, #

1'#- c>0 '%' '- . -*- ' -*( ' )(nfcn

fa ⋅≤

⋅1'#- c>0 '%' '- . -*- ' -*( '

' c !-' '''( ' a, b ' '# '" f(n) f(n/b).

:

*-'- ' #:

:

3\$":

\$*-: + '- ->0

% \$" +\$- c<1 '%' '-:

3

24)( n

nTnT +

=

)()( 23 ε+Ω== nnnf

24loglog,)(,2,4 2

3===== annfba b

)(nfcb

fa ⋅≤

% \$" +\$- c<1 '%' '-:

7 \$*- ½;c<1.

7 +, ' ’ +-!+'" ' -"#'( 4\$!( %+-' ,':

)()( 3nnT Θ=

cccnn

cnn

ncfn

fncfb

naf ≤⇔≤⇔≤⇔≤

⇔≤

⇔≤

2

1

8

4

24

24)(

24)( 3

3

33

3

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/(

!"#\$%&'"#\$()%*+#\$%

%( -+/( -! ! %( + * '( '(

++,''( ( #( '( 2#( T(n)=aT(n/b)+f(n), +!++,''( ( #( '( 2#( T(n)=aT(n/b)+f(n), +!

!-' - ' -0#( 5#':

1. 4- 3 -2 %( '( #( \$%( (%\$ 2'- '

2# )

2. '! '( -( + +*+'- -' +, k -+#/-( ((

-! ,( )

.......)(3

+

⋅=

b

nTnT

.......)( +

⋅=

kb

nTnT

nn

=3. + !1- +,'- ''- # (%'" ,+ n0 #

'-'* '( #( *- "( +( k). .\$. n0=1 ','-

k=logbn

4. ''' ' k ' , '*+ ' 5#'( 2.

5. + ,( ' !'( + +%/-.

0nb

nk

=

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/( (.# 1: 3 -2 %( ' ,)

, !"#\$%&'"#\$()%*+#\$%

' 1 5# -2,1- ' , , 3 2%( - '(

+0-( + +*+'.+0-( + +*+'.

.' ' +,\$-, + !1- '( *( ,( -

''' ' #

:

*-'- ' #:

:

=

>+

=

1,1

1,3

5)(

n

nnn

TnT

αν

αν

+

= nn

TnT 5)( 5)( nn

TnT +

=

6

=+++

=++

+

=

++

=+

+

=

+

=

nnnn

Tnnnn

T

nnn

Tnnn

T

nTnT

35

35

35

35

3355

35

35

3355

35)(

2

2

3

3

23

2

2

2

2

232

2

335

3

335

3

35)(

nnT

nT

nnT

nT

nTnT

+

=

+

=

+

=

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/( (.# 2: '! ' 5# k)

- !"#\$%&'"#\$()%*+#\$%

' 2 5# -'- ' - + +*/- -' +, k -+#/-(

(( -! ,( .......)( +

⋅=n

TnT(( -! ,(

(…%\$-…)

nnnnn

T

nnnn

T

k

k

k

k+++++

=

==

=+++

=

35

35...

35

35

...

35

35

35

2

2

1

1

2

2

3

3

.......)( +

⋅=kb

TnT

3333

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/( (.# 3: + ,( ' k)

. !"#\$%&'"#\$()%*+#\$%

+ !1- +,'- ''- # (%'" ,+ n0 #

'-'* '( #( *- "( +( k).

0nb

nk

=

'-'* '( #( *- "( +( k).

(…%\$-…)

# '' ,'nk1

3

=

=

nk

kn

n

n

k

k

3

33

33

log

3loglog

3loglog

3

=

=

=

=

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/( (.# 4: ''' ' k)

/ !"#\$%&'"#\$()%*+#\$%

''*- ' k + 5#- ' +' + +%/- ' 5#

2. +%+- +-2-! ,( ,( - ' #2. +%+- +-2-! ,( ,( - ' #

'-'* '( #(.

(…%\$-…)

%''( k=log3n ' (n) %\$-:

nnn

nnnnn

TnTn

n

n

n+++++

=

35

35...

35

35)(

2

2

1log

1log

log

log

3

3

3

3

( )

nnnn

nnnn

T

n

nn

n

nn

+++++=

+++++=

35

35...

355

35

35...

3515

2

2

1log

1loglog

2

2

1log

1loglog

3

33

3

33

. - ! #-"1. # T(n)=aT(n/b)+f(n)2. +! - ' % -+/( (.# 5: + ,( ' !'()

0 !"#\$%&'"#\$()%*+#\$%

+ !1- ' + +*+'-. ' % -+/(

+*+'- +' -"-'# +,( '( '-%( + -2!1' +*+'- +' -"-'# +,( '( '-%( + -2!1'

’ ', -! \$# \$%:

(…%\$-…)

nn

nnnn

nnnn

nT

ni

nn in

n

nn

n

nn

5555

35...

35

355

35

35...

355)(

33

3

33

3

33

1loglog1loglog

1log

1log

2

2log

2

2

1log

1loglog

=+=+=

=

+++++=

=+++++=

−−

=

+

−=

n

i

ni

x

xx

0

1

1

1

7

nnn

nn

nn

nnn

n

n

i

inn

i

i

n

n

i i

nn

i i

in

5,166,15,15166,1

166,15

66,153

55

3

55

355

33

3

3

3333

3333

loglog11log

log

1log

0

log1log

0

log

1log

0

log1log

0

log

−⋅⋅+=−

−+=

=+=

+=

=+=+=

+−

=

=

=

=

nnnTnn

5,166,15,15)( 33 loglog−⋅⋅+=

&. #-(2 # 1

+ !'- ! +'"'# -'! '( ++,''( '"

:

!"#\$%&'"#\$()%*+#\$%

:

4

3

2

28)()

28)()

28)()

nn

TnTC

nn

TnTB

nn

TnTA

+

=

+

=

+

=

&. #-(2 # 2

*'- '( %(:

!"#\$%&'"#\$()%*+#\$%

3

2

25)()

25)()

nn

TnTB

nn

TnTA

+

=

+

=

&. #-(2 # 3

+ !'- ' 5# ++,'' '" :

!"#\$%&'"#\$()%*+#\$%

>+

=

=

>+

=

1,3

4)()

1,1

1,2

6)()

2 nnn

TnTB

n

nnn

TnTA

αν

αν

αν

=

1,1

3nαν