Lecture note Data visualization - Chapter 17
Số trang: 34
Loại file: pptx
Dung lượng: 1.08 MB
Lượt xem: 3
Lượt tải: 0
Xem trước 4 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
The main contents of the chapter consist of the following: Remaining part of maximum contiguous subsequence sum problem, general big-oh rule, running time of algorithm.
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 17Lecture17RecapRemainingPartofMaximumContiguousSubsequence SumProblemGeneralBigOhRule BigOh BigOmega BigTheta LittleOhRunningTimeofAlgorithmRunningTimeofCubicAlgorithmRunningTimeofQuadraticAlgorithmRunningTimeofLinearAlgorithm Asimilarcalculationshowsthata10foldincreasein inputsizeresultsina10foldincreaseinrunningtimeThisrelationshiphasbeenconfirmedexperimentallyForalinearprogramthetermsufficientlylargemeansa somewhathigherinputsizethanfortheotherprogramsThereasonisthatoftheoverheadof0.000003secis usedinallcasesForalinearprogram,thistermisstillsignificantfor moderateinputsizesRunningTimeofLogarithmicTermsTheLogarithmThelistoftypicalgrowthratefunctionsincludesseveral entriescontainingthelogarithmAlogarithmistheexponentthatindicatesthepowerto whichanumber(thebase)israisedtoproduceagiven numberDefinitionofLogarithmTheorem6.4LogarithmContinued….BitsinaBinaryNumberRepeatedDoublingRepeatedHalvingContinued….Manyofthealgorithmscontainlogarithms,becauseofthe repeatedhalvingprinciple,whichholdsthat,startingatN, wecanhalveonlylogarithmicallymanytimesInotherwords,analgorithmisO(logN)ifittakes constant(O(1))timetocuttheproblemsizebyaconstant fraction(usually112)Thisconditionfollowsdirectlyfromthefactthatthere willbeO(logN)iterationsoftheloopAnyconstantfractionwilldobecausethefractionis reflectedinthebaseofthelogarithm,andTheorem6.4 tellsusthatthebasedoesnotmatterTheorem6.5StaticSearchingProblemAnimportantuseofcomputersistolookupdataIfthedataarenotallowedtochange(e.g.,itisstoredona CDROM),wesaythatthedataarestaticAstaticsearchaccessesdatathatareneveralteredProblem GIVENANINTEGERXANDANARRAYA, RETURNTHEPOSITIONOFXINAORAN INDICATIONTHATITISNOTPRESENT.IFX OCCURSMORETHANONCE,RETURNANY OCCURRENCE.THEARRAYAISNEVER ALTERED.SolutionAnexampleofstaticsearchingislookingupapersonin thetelephonebookTheefficiencyofastaticsearchingalgorithmdependson whetherthearraybeingsearchedissortedInthecaseofthetelephonebook,searchingbynameis fast,butsearchingbyphonenumberishopelessSomesolution SequentialSearch BinarySearch SequentialSearchWhentheinputarrayhasnotbeensorted,wehavelittle choicebuttodoalinearsequentialsearchthatsteps throughthearraysequentiallyuntilamatchisfoundThecomplexityofthealgorithmisanalyzedinthreeways First,weprovidethecostofanunsuccessfulsearch Second,wegivetheworstcasecostofasuccessfulsearch Finally,wefindtheaveragecostofasuccessfulsearchAnalyzingsuccessfulandunsuccessfulsearches separatelyistypicalContinued….Anunsuccessfulsearchrequirestheexaminationofevery iteminthearray,sothetimewillbeO(N)Intheworstcase,asuccessfulsearch,too,requiresthe examinationofeveryiteminthearraybecausewemight notfindamatchuntilthelastitem.Thustheworstcase runningtimeforasuccessfulsearchisalsolinearOnaverage,however,wesearchonlyhalfanarray.That is,foreverysuccessfulsearchinpositioni,thereisa correspondingsuccessfulsearchinpositionN1iHowever,N/2isstillO(N)
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 17Lecture17RecapRemainingPartofMaximumContiguousSubsequence SumProblemGeneralBigOhRule BigOh BigOmega BigTheta LittleOhRunningTimeofAlgorithmRunningTimeofCubicAlgorithmRunningTimeofQuadraticAlgorithmRunningTimeofLinearAlgorithm Asimilarcalculationshowsthata10foldincreasein inputsizeresultsina10foldincreaseinrunningtimeThisrelationshiphasbeenconfirmedexperimentallyForalinearprogramthetermsufficientlylargemeansa somewhathigherinputsizethanfortheotherprogramsThereasonisthatoftheoverheadof0.000003secis usedinallcasesForalinearprogram,thistermisstillsignificantfor moderateinputsizesRunningTimeofLogarithmicTermsTheLogarithmThelistoftypicalgrowthratefunctionsincludesseveral entriescontainingthelogarithmAlogarithmistheexponentthatindicatesthepowerto whichanumber(thebase)israisedtoproduceagiven numberDefinitionofLogarithmTheorem6.4LogarithmContinued….BitsinaBinaryNumberRepeatedDoublingRepeatedHalvingContinued….Manyofthealgorithmscontainlogarithms,becauseofthe repeatedhalvingprinciple,whichholdsthat,startingatN, wecanhalveonlylogarithmicallymanytimesInotherwords,analgorithmisO(logN)ifittakes constant(O(1))timetocuttheproblemsizebyaconstant fraction(usually112)Thisconditionfollowsdirectlyfromthefactthatthere willbeO(logN)iterationsoftheloopAnyconstantfractionwilldobecausethefractionis reflectedinthebaseofthelogarithm,andTheorem6.4 tellsusthatthebasedoesnotmatterTheorem6.5StaticSearchingProblemAnimportantuseofcomputersistolookupdataIfthedataarenotallowedtochange(e.g.,itisstoredona CDROM),wesaythatthedataarestaticAstaticsearchaccessesdatathatareneveralteredProblem GIVENANINTEGERXANDANARRAYA, RETURNTHEPOSITIONOFXINAORAN INDICATIONTHATITISNOTPRESENT.IFX OCCURSMORETHANONCE,RETURNANY OCCURRENCE.THEARRAYAISNEVER ALTERED.SolutionAnexampleofstaticsearchingislookingupapersonin thetelephonebookTheefficiencyofastaticsearchingalgorithmdependson whetherthearraybeingsearchedissortedInthecaseofthetelephonebook,searchingbynameis fast,butsearchingbyphonenumberishopelessSomesolution SequentialSearch BinarySearch SequentialSearchWhentheinputarrayhasnotbeensorted,wehavelittle choicebuttodoalinearsequentialsearchthatsteps throughthearraysequentiallyuntilamatchisfoundThecomplexityofthealgorithmisanalyzedinthreeways First,weprovidethecostofanunsuccessfulsearch Second,wegivetheworstcasecostofasuccessfulsearch Finally,wefindtheaveragecostofasuccessfulsearchAnalyzingsuccessfulandunsuccessfulsearches separatelyistypicalContinued….Anunsuccessfulsearchrequirestheexaminationofevery iteminthearray,sothetimewillbeO(N)Intheworstcase,asuccessfulsearch,too,requiresthe examinationofeveryiteminthearraybecausewemight notfindamatchuntilthelastitem.Thustheworstcase runningtimeforasuccessfulsearchisalsolinearOnaverage,however,wesearchonlyhalfanarray.That is,foreverysuccessfulsearchinpositioni,thereisa correspondingsuccessfulsearchinpositionN1iHowever,N/2isstillO(N)
Tìm kiếm theo từ khóa liên quan:
Data visualization Lecture note Data visualization Data structures Data Visualization with C Data visualization with matlab Effective graphical displayGợi ý tài liệu liên quan:
-
Trực quan hóa dữ liệu: Vai trò & thử thách
10 trang 37 0 0 -
Ebook Eloquent JavaScript - A modern introduction to programming: Part 1
199 trang 32 0 0 -
Ebook Management support systems: Part 2 - Dr. Kamlesh Lakhwani
136 trang 31 0 0 -
Lecture Introduction to computing systems (2/e): Chapter 19 - Yale N. Patt, Sanjay J. Patel
28 trang 30 0 0 -
Ebook Introduction to algorithms (3rd edition)
1313 trang 27 0 0 -
Lecture Data Structures: Lesson 38
71 trang 26 0 0 -
Lecture Data structures and algorithms: Chapter 1 - Introduction
41 trang 26 0 0 -
Lecture note Data visualization - Chapter 22
21 trang 24 0 0 -
Lecture Data Structures: Lesson 41
18 trang 23 0 0 -
335 trang 23 0 0