Tải bản đầy đủ - 0 (trang)
B.4 Extending Results for n, a Power of a Positive Constant b, to n in General

B.4 Extending Results for n, a Power of a Positive Constant b, to n in General

Tải bản đầy đủ - 0trang

and2nareallstrictlyincreasingaslongasnisnonnegative.





FigureB.1:Fourfunctions.

Definition Acomplexityfunctionf(n)iscallednondecreasingiff(n)

nevergetssmallerasngetslarger.Thatis,ifn1>n2,

then



Anystrictlyincreasingfunctionisnondecreasing,butafunctionthatcan

leveloutisnondereasingwithoutbeingstrictlyincreasing.Thefunction

showninFigureB.1(b)isanexampleofsuchafunction.Thefunctionin

FigureB.1(c)isnotnondecreasing.

Thetime(ormemory)complexitiesofmostalgorithmsareordinarily

nondecreasingbecausethetimeittakestoprocessaninputusuallydoes

notdecreaseastheinputsizebecomeslarger.LookingatFigureB.1,it

seemsthatweshouldbeabletoextendananalysisfornapowerofbto

ningeneralaslongasthefunctionisnondecreasing.Forexample,



supposewehavedeterminedthevaluesoff(n)fornapowerof2.In

caseofthefunctioninFigureB.1(c),anythingcanhappenbetween,say,

23=8and24=16.Therefore,nothingcanbeconcludedaboutthe

behaviorofthefunctionbetween8and16fromthevaluesat8and16.

However,inthecaseofanondecreasingfunctionf(n),if8≤n≤16then



Soitseemsthatweshouldbeabletodeterminetheorderoff(nfromthe

valuesoff(n)fornapowerof2.Whatseemstobetrueintuitivelycan

indeedbeprovenforalargeclassoffunctions.Beforegivingatheorem

statingthis,werecallthatorderhastodoonlywithlong-rangebehavior.

Becauseinitialvaluesofafunctionareunimportant,thetheoremrequires

onlythatthefunctionbeeventuallynondecreasing.Wehavethe

followingdifinition:

Definition Acomplexityfunctionf(n)iscalledeventually

nondecreasingifforallnpastsomepointthefunction

nevergetssmallerasngetslarger.Thatis,thereexists

anNsuchthatifn1>n2N,then



Anynondecreasingfunctioniseventuallynondecreasing.Thefunction

showninFigure3.1(d)isanexampleofaneventuallynondecreasing

functionthatisnotnondecreasing.Weneedthefollowingdefinition

beforewegivethetheoremforextendingtheresultsfornapowerofb:

Definition Acomplexityfunctionf(n)iscalledsmoothiff(n)is

eventuallynondecreasingandif



ExampleB.23

Thefunctionslgn,nlgn,andnk,wherek≥0,areallsmooth.Weshow



thisforlgn.Intheexercisesyouareaskedtoshowitfortheother

functions.Wehavealreadynotedthatlgniseventuallynondecreasing.

Astothesecondcondition,wehave



ExampleB.24

Thefunction2nisnotsmooth,becausethePropertiesofOrderin

Section1.4.2inChapter1implythat



Therefore,



Wenowstatethetheoremthatenablesustogeneralizeresultsobtained

fornapowerofb.Theproofappearsneartheendofthisappendix.

TheoremB.4

Letb≥2beaninteger,letf(n)beasmoothcomplexityfunction,andlet

T(n)beaneventuallynondecreasingcomplexityfunction.If



then



Furthermore,thesameimplicationholdsifΘisreplacedby"bigO,"Ω,or

"smallo."



By"T(n)∊Θ(f(n))fornapowerofb,"wemeanthattheusualconditins

forΘareknowntoholdwhennisrestrictedtobeingapowerofb.Notice

inTheoremB.4theadditionalrequirementthatf(n)besmooth.

NextweapplyTheoremB.4

ExampleB.25

Supposeforsomecomlexityfunctionweestablishthat



Whennisapowerof2,wehavetherecurrenceinExampleB.18.

Therefore,bythatexample,



Becauselgnissmooth,weneedonlyshowthatT(n)iseventually

nondecreasinginordertoapplyTheoremB.4toconcludethat



OnemightbetemptedtoconcludethatT(n)iseventuallynondecreasing

fromthefactthatlgn+1iseventuallynondecreasing.However,we

cannotdothisbecauseweknowonlythatT(n)=lgn+1whennisa

powerof2.Givenonlythisfact,T(n)couldexhibitanypossiblebehavior

inbetweenpowersof2.

WeshowthatT(n)iseventuallynondecreasingbyusinginductionto

establishforn≥2thatif1≤k


Inductionbase:Forn=2,



Therefore,



Inductionhypothesis:Onewaytomaketheinductionhypothesisisto

assumethatthestatementistrueforallm≤n.Then,asusual,weshow

thatitistrueforn+1.Thisisthewayweneedittobestatedhere.Letn

beanarbitraryintegergreaterthanorequalto2.Assumeforallm≤n

thatifk


Inductionstep:Becauseintheinductionhypothesisweassumedfork<

nthat



weneedonlyshowthat



Tothatend,itisnothardtoseethatifn≥1,then



Therefore,bytheinductionhypothesis,



Usingtherecurrence,wehave



andwearedone.



Finally,wedevelopageneralmethodfordeterminingtheorderofsome

commonrecurrences.

TheoremB.5

SupposeacomplexityfunctionT(n)iseventuallynondecreasingand

satisfies



whereb≥2andk≥0areconstantintegers,anda,c,anddare

constantssuchthata>0,c>0,andd≥0.Then



Furthermore,if,inthestatementoftherecurrence,



isreplacedby



thenResultB.5holdswith"bigO"orΩ,respectively,replacingΘ.



Wecanprovethistheorembysolvingthegeneralrecurrenceusingthe

characteristicequationandthenapplyingTheoremB.4.Example

applicationsofTheoremB.5follow.



ExampleB.26

SupposethatT(n)iseventuallynondecreasingandsatisfies



ByTheoremB.5,because842,



ExampleB.27

SupposethatT(n)iseventuallynondecreasingandsatisfies



ByTheoremB.5,because9>31,



TheoremB.5wasstatedinordertointroduceanimportanttheoremas

simplyaspossible.Itisactuallythespecialcase,inwhichtheconstants

equals1,ofthefollowingtheorem.

TheoremB.6

SupposethatacomplexityfunctionT(n)iseventuallynondecreasingand



satisfies



wheresisaconstantthatisapowerofb,b≥2andk≥0areconstant

integers,anda,c,anddareconstantssuchthata>0,c>0,andd≥0.

ThentheresultsinTheoremB.5stillhold.



ExampleB.28

SupposethatT(n)iseventuallynondecreasingandsatisfies



ByTheoremB.6,because8=23,



Thisconcludesourdiscussionoftechniquesforsolvingrecurrences.

Anothertechniqueistouse"generatingfunctions"tosolverecurrences.

ThistechniqueisdiscussedinSahni(1988).Bentley,Haken,andSax

(1980)provideageneralmethodforsolvingrecurrencesarisingfromthe

analysisofdivide-and-conqueralgorithms(seeChapter2).



B.5ProofsofTheorems

ThefollowinglemmaisneededtoproveTheoremB.1.

LemmaB.1

Supposewehavethehomogeneouslinearrecurrence



Ifr1isarootofthecharacteristicequation



then



isasolutiontotherecurrence.

Proof:If,fori=n–k,…,n,wesubstituteri1fortiintherecurrence,we

obtain



Therefore,rn1isasolutiontotherecurrence.



ProofofTheoremB.1Itisnothardtoseethat,foralinearhomogeneous

recurrence,aconstanttimesanysolutionandthesumofanytwo

solutionsareeachsolutionstotherecurrence.Wecanthereforeapply

LemmaB.1toconcludethat,if



arethekdistinctrootsofthecharacteristicequation,then



wherethecitermsarearbitraryconstants,isasolutiontotherecurrence.

Althoughwedonoshowithere,onecanprovethatthesearetheonly

solutions.

ProofofTheoremB.2Weprovethecasewherethemultiplicitym

equals2.Thecaseofalargermisastraightforwardgeneralization.Let

r1bearootofmultiplicity2.Set



whereq′(r)meansthefirstderivative.Ifwesubsituteiri1fortiinthe

recurrence,weobtainu(r1).Therefore,ifwecanshowthatu(r1)=0,we

canconcludethattn=nrn1isasolutiontotherecurrence,andweare

done.Tothisend,wehave



Therefore,toshowthatu(r1)=0,weneedonlyshowthatp(r1)andp′

(r1)bothequal0.Weshowthisasfollows.Becauser1isasolutionof

multiplicity2ofthecharacteristicequationp(r),thereexistsav(r)such

that



Therfore,



andp(r1)andp′(r1)bothequal0.Thiscompletestheproof.

ProofofTheoremB.4Weobtaintheprooffor"bigO."ProofforΩand

Θcanbeestablishedinasimilarmanner.BecauseT(n)∊O(f(n)forall

nsuchthatnisapowerofb,thereexistapositivec1andanonnegative

integerN1suchthat,forn>N1andnapowerofb,



Foranypositiveintegern,thereexistsauniqueksuchthat



Itispossibletoshow,inthecaseofasmoothfunction,thatifb≥2,then



Thatis,ifthisconditionholdsfor2,itholdsforanyb>2.Therefore,there

existapositiveconstantc2andanonnegativeintegerN2suchthat,forn

>N2,



Therefore,ifbk≥N2,



BecauseT(n)andf(n)arebotheventuallynondecreasing,thereexists

anN3,suchthat,form>n>N3,



Letrbesolargethat



Ifn>brandkisthevaluecorrespondingtoninInequalityB.7,then



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

B.4 Extending Results for n, a Power of a Positive Constant b, to n in General

Tải bản đầy đủ ngay(0 tr)

×