![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
Lecture note Data visualization - Chapter 16
Số trang: 21
Loại file: pptx
Dung lượng: 1.10 MB
Lượt xem: 4
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
This chapter presents the following content: Introduction to algorithm analysis, different functions, function’s growth rate, three problems related to algorithm running time, maximum contiguous subsequence sum problem.
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 16Lecture16RecapIntroductiontoAlgorithmAnalysisDifferentFunctionsFunction’sGrowthRateThreeProblemsRelatedtoAlgorithmRunningTime FindMinimuminanArray FindClosestPointinaPlane FindCollinearPointsinaPlaneMaximumContiguousSubsequenceSumProblemTheorem6.1ProofPlacethefollowingN+2ballsinabox:Nballs numbered1throughN,oneunnumberedredballandone unnumberedblueball.Removethreeballsfromthebox.Ifaredballisdrawn,numberitasthelowestofthe numberedballsdrawn.Ifablueballisdrawn,numberitashighestofthe numberedballsdrawn.Notethatifyoudrawbotharedandablueball,thenthe effectistohavethreeballsidenticalnumbered.Orderthe threeballs.Eachsuchordercorrespondstoatripletsolutiontothe1//Quadraticmaximumcontiguoussubsequencesum algorithm.2//seqStartandseqEndrepresenttheactualbest sequence.3template4ComparablemaxSubsequenceSum(const vector&a,5 int&seqstart,int&seqEnd)6(7intn=a.size();8ComparablemaxSum=0;9LinearAlgorithmTomovefromaquadraticalgorithmtoalinearalgorithm, weneedtoremoveyetanotherloopTheproblemisthatthequadraticalgorithmisstillan exhaustivesearch;thatis,wearetryingallpossible subsequencesTheonlydifferencebetweenthequadraticandcubic algorithmsisthatthecostoftestingeachsuccessive subsequenceisaconstantO(1)insteadoflinearO(N)Becauseaquadraticnumberofsubsequencesarepossible, theonlywaywecanattainasubquadraticboundistofind acleverwaytoeliminatefromconsiderationalargeTheorem6.2LinearAlgorithmContinued….Theorem6.31//Linearmaximumcontiguoussubsequencesum algorithm.2//seqStartandseqEndrepresenttheactualbest sequence.3template4ComparablemaxSubsequenceSum(const vector&a,5int&seqstart,int&seqEnd)6{7intn=a.size();8Comparablethissum=0;9ComparablemaxSum=0;LinearAlgorithmContinued….AccordingtoTheorem6.3whenanegativesubsequence isdetected,notonlycanwebreaktheinnerloop,butwe canalsoadvanceitoj+1Therunningtimeofthisalgorithmislinear:Ateachstep intheloop,weadvancej,sotheloopiteratesatmostN timesThecorrectnessofthisalgorithmismuchlessobvious thanforthepreviousalgorithms,whichistypical.Thatis, algorithmsthatusethestructureofaproblemtobeatan exhaustivesearchgenerallyrequiresomesortof correctnessproofWeprovedthatthealgorithmiscorrectbyusingashortGeneralBigOhRulesBigOhNotationBigOmegaNotationBigThetaNotationLittleOhNotationSummaryofFourDefinitionRunningTimeofAlgorithmsTherunningtimeofstatementsinsideagroupofnested loopsistherunningtimeofthestatementsmultipliedby thesizesofalltheloopsTherunningtimeofasequenceofconsecutiveloopsis therunningtimeofthedominantloopThetimedifferencebetweenanestedloopinwhichboth indicesrunfrom1toNandtwoconsecutiveloopsthatare notnestedbutrunoverthesameindicesisthesameasthe spacedifferencebetweenatwodimensionalarrayandtwo onedimensionalarrays Thefirstcaseisquadratic
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 16Lecture16RecapIntroductiontoAlgorithmAnalysisDifferentFunctionsFunction’sGrowthRateThreeProblemsRelatedtoAlgorithmRunningTime FindMinimuminanArray FindClosestPointinaPlane FindCollinearPointsinaPlaneMaximumContiguousSubsequenceSumProblemTheorem6.1ProofPlacethefollowingN+2ballsinabox:Nballs numbered1throughN,oneunnumberedredballandone unnumberedblueball.Removethreeballsfromthebox.Ifaredballisdrawn,numberitasthelowestofthe numberedballsdrawn.Ifablueballisdrawn,numberitashighestofthe numberedballsdrawn.Notethatifyoudrawbotharedandablueball,thenthe effectistohavethreeballsidenticalnumbered.Orderthe threeballs.Eachsuchordercorrespondstoatripletsolutiontothe1//Quadraticmaximumcontiguoussubsequencesum algorithm.2//seqStartandseqEndrepresenttheactualbest sequence.3template4ComparablemaxSubsequenceSum(const vector&a,5 int&seqstart,int&seqEnd)6(7intn=a.size();8ComparablemaxSum=0;9LinearAlgorithmTomovefromaquadraticalgorithmtoalinearalgorithm, weneedtoremoveyetanotherloopTheproblemisthatthequadraticalgorithmisstillan exhaustivesearch;thatis,wearetryingallpossible subsequencesTheonlydifferencebetweenthequadraticandcubic algorithmsisthatthecostoftestingeachsuccessive subsequenceisaconstantO(1)insteadoflinearO(N)Becauseaquadraticnumberofsubsequencesarepossible, theonlywaywecanattainasubquadraticboundistofind acleverwaytoeliminatefromconsiderationalargeTheorem6.2LinearAlgorithmContinued….Theorem6.31//Linearmaximumcontiguoussubsequencesum algorithm.2//seqStartandseqEndrepresenttheactualbest sequence.3template4ComparablemaxSubsequenceSum(const vector&a,5int&seqstart,int&seqEnd)6{7intn=a.size();8Comparablethissum=0;9ComparablemaxSum=0;LinearAlgorithmContinued….AccordingtoTheorem6.3whenanegativesubsequence isdetected,notonlycanwebreaktheinnerloop,butwe canalsoadvanceitoj+1Therunningtimeofthisalgorithmislinear:Ateachstep intheloop,weadvancej,sotheloopiteratesatmostN timesThecorrectnessofthisalgorithmismuchlessobvious thanforthepreviousalgorithms,whichistypical.Thatis, algorithmsthatusethestructureofaproblemtobeatan exhaustivesearchgenerallyrequiresomesortof correctnessproofWeprovedthatthealgorithmiscorrectbyusingashortGeneralBigOhRulesBigOhNotationBigOmegaNotationBigThetaNotationLittleOhNotationSummaryofFourDefinitionRunningTimeofAlgorithmsTherunningtimeofstatementsinsideagroupofnested loopsistherunningtimeofthestatementsmultipliedby thesizesofalltheloopsTherunningtimeofasequenceofconsecutiveloopsis therunningtimeofthedominantloopThetimedifferencebetweenanestedloopinwhichboth indicesrunfrom1toNandtwoconsecutiveloopsthatare notnestedbutrunoverthesameindicesisthesameasthe spacedifferencebetweenatwodimensionalarrayandtwo onedimensionalarrays Thefirstcaseisquadratic
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 displayTà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 36 0 0 -
Ebook Management support systems: Part 2 - Dr. Kamlesh Lakhwani
136 trang 32 0 0 -
Lecture Introduction to computing systems (2/e): Chapter 19 - Yale N. Patt, Sanjay J. Patel
28 trang 31 0 0 -
Ebook Introduction to algorithms (3rd edition)
1313 trang 30 0 0 -
Lecture Data Structures: Lesson 38
71 trang 28 0 0 -
Lecture Data structures and algorithms: Chapter 1 - Introduction
41 trang 28 0 0 -
Ebook Introduction to algorithms (Second Edition)
429 trang 27 0 0 -
335 trang 26 0 0
-
Lecture Data Structures: Lesson 32
16 trang 25 0 0