SlideShare uma empresa Scribd logo
1 de 27
CS 332: Algorithms Quicksort
Review: Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review: Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object]
Review: Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object]
Review: Analyzing Quicksort (Average Case) ,[object Object],[object Object],[object Object],[object Object]
Review: Analyzing Quicksort (Average Case) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review: Analyzing Quicksort (Average Case) ,[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],Write it on  the board
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort: Average Case Note: leaving the same recurrence as the book What are we doing here? The recurrence to be solved What are we doing here? What are we doing here? Plug in inductive hypothesis Expand out the k=0 case 2b/n is just a constant,  so fold it into   (n)
Analyzing Quicksort: Average Case What are we doing here? What are we doing here? Evaluate the summation:  b+b+…+b = b (n-1) The recurrence to be solved Since n-1<n, 2b(n-1)/n < 2b What are we doing here? Distribute the summation This summation gets its own set of slides later
Analyzing Quicksort: Average Case How did we do this? Pick a large enough that an/4 dominates   (n)+b  What are we doing here? Remember, our goal is to get T(n)    an  lg  n + b What the hell? We’ll prove this later What are we doing here? Distribute the (2a/n) term The recurrence to be solved
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object],[object Object]
Tightly Bounding  The Key Summation What are we doing here? The  lg  k in the second term is bounded by  lg  n What are we doing here? Move the  lg  n outside the summation What are we doing here? Split the summation for a tighter bound
Tightly Bounding The Key Summation The summation bound so far What are we doing here? The  lg  k in the first term is bounded by  lg  n/2 What are we doing here? lg  n/2 =  lg  n  - 1 What are we doing here? Move ( lg  n  - 1 ) outside the summation
Tightly Bounding The Key Summation The summation bound so far What are we doing here? Distribute the ( lg  n  - 1 ) What are we doing here? The summations overlap in  range; combine them What are we doing here? The Guassian series
Tightly Bounding  The Key Summation The summation bound so far What are we doing here? Rearrange first term, place upper bound on second What are we doing? X Guassian series What are we doing? Multiply it  all out
Tightly Bounding  The Key Summation

Mais conteúdo relacionado

Mais procurados

Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquer
chidabdu
 
Potentials and fields
Potentials and fieldsPotentials and fields
Potentials and fields
Avie Tavianna
 
Integration basics
Integration basicsIntegration basics
Integration basics
Tarun Gehlot
 
Skiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortSkiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksort
zukun
 
annals-v181-n1-p06-p
annals-v181-n1-p06-pannals-v181-n1-p06-p
annals-v181-n1-p06-p
Robert Hough
 
Persamaan schroedinger bebas waktu
Persamaan schroedinger bebas waktuPersamaan schroedinger bebas waktu
Persamaan schroedinger bebas waktu
Fani Diamanti
 
Probabilistic group theory, combinatorics, and computing
Probabilistic group theory, combinatorics, and computingProbabilistic group theory, combinatorics, and computing
Probabilistic group theory, combinatorics, and computing
Springer
 

Mais procurados (20)

Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquer
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 
Retarded potential
Retarded potentialRetarded potential
Retarded potential
 
Potentials and fields
Potentials and fieldsPotentials and fields
Potentials and fields
 
Mechanical Engineering Assignment Help
Mechanical Engineering Assignment HelpMechanical Engineering Assignment Help
Mechanical Engineering Assignment Help
 
Differential equations final -mams
Differential equations final -mamsDifferential equations final -mams
Differential equations final -mams
 
potential and fields
potential and fieldspotential and fields
potential and fields
 
Integration basics
Integration basicsIntegration basics
Integration basics
 
Skiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortSkiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksort
 
annals-v181-n1-p06-p
annals-v181-n1-p06-pannals-v181-n1-p06-p
annals-v181-n1-p06-p
 
Linear response theory
Linear response theoryLinear response theory
Linear response theory
 
Application of laplace transform
Application of laplace transformApplication of laplace transform
Application of laplace transform
 
Ch7 angular momentum
Ch7 angular momentumCh7 angular momentum
Ch7 angular momentum
 
Persamaan schroedinger bebas waktu
Persamaan schroedinger bebas waktuPersamaan schroedinger bebas waktu
Persamaan schroedinger bebas waktu
 
Cis435 week03
Cis435 week03Cis435 week03
Cis435 week03
 
Reductions
ReductionsReductions
Reductions
 
TLT
TLTTLT
TLT
 
Wave functions
Wave functionsWave functions
Wave functions
 
Probabilistic group theory, combinatorics, and computing
Probabilistic group theory, combinatorics, and computingProbabilistic group theory, combinatorics, and computing
Probabilistic group theory, combinatorics, and computing
 
Foundation of KL Divergence
Foundation of KL DivergenceFoundation of KL Divergence
Foundation of KL Divergence
 

Destaque

Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5
Kumar
 

Destaque (13)

Cis435 week02
Cis435 week02Cis435 week02
Cis435 week02
 
cvjeroendewandel
cvjeroendewandelcvjeroendewandel
cvjeroendewandel
 
Predicate &amp; quantifier
Predicate &amp; quantifierPredicate &amp; quantifier
Predicate &amp; quantifier
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relation
 
Recurrence relations
Recurrence relationsRecurrence relations
Recurrence relations
 
Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5
 
recurrence relations
 recurrence relations recurrence relations
recurrence relations
 
Reccurrence relations
Reccurrence relationsReccurrence relations
Reccurrence relations
 
Recurrences
RecurrencesRecurrences
Recurrences
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiers
 
Merge sort
Merge sortMerge sort
Merge sort
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 

Semelhante a lecture 8

T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
GadaFarhan
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
Sri Prasanna
 
Quicksort analysis
Quicksort analysisQuicksort analysis
Quicksort analysis
Premjeet Roy
 
Skiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notationSkiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notation
zukun
 

Semelhante a lecture 8 (20)

Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 
lecture8.ppt
lecture8.pptlecture8.ppt
lecture8.ppt
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 
big_oh
big_ohbig_oh
big_oh
 
Approx
ApproxApprox
Approx
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
probability assignment help (2)
probability assignment help (2)probability assignment help (2)
probability assignment help (2)
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Time complexity
Time complexityTime complexity
Time complexity
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 
series.pdf
series.pdfseries.pdf
series.pdf
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
3.pdf
3.pdf3.pdf
3.pdf
 
Quicksort analysis
Quicksort analysisQuicksort analysis
Quicksort analysis
 
Skiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notationSkiena algorithm 2007 lecture02 asymptotic notation
Skiena algorithm 2007 lecture02 asymptotic notation
 

Mais de sajinsc

lecture 30
lecture 30lecture 30
lecture 30
sajinsc
 
lecture 29
lecture 29lecture 29
lecture 29
sajinsc
 
lecture 28
lecture 28lecture 28
lecture 28
sajinsc
 
lecture 27
lecture 27lecture 27
lecture 27
sajinsc
 
lecture 26
lecture 26lecture 26
lecture 26
sajinsc
 
lecture 25
lecture 25lecture 25
lecture 25
sajinsc
 
lecture 24
lecture 24lecture 24
lecture 24
sajinsc
 
lecture 23
lecture 23lecture 23
lecture 23
sajinsc
 
lecture 22
lecture 22lecture 22
lecture 22
sajinsc
 
lecture 21
lecture 21lecture 21
lecture 21
sajinsc
 
lecture 20
lecture 20lecture 20
lecture 20
sajinsc
 
lecture 19
lecture 19lecture 19
lecture 19
sajinsc
 
lecture 18
lecture 18lecture 18
lecture 18
sajinsc
 
lecture 17
lecture 17lecture 17
lecture 17
sajinsc
 
lecture 16
lecture 16lecture 16
lecture 16
sajinsc
 
lecture 15
lecture 15lecture 15
lecture 15
sajinsc
 
lecture 14
lecture 14lecture 14
lecture 14
sajinsc
 
lecture 13
lecture 13lecture 13
lecture 13
sajinsc
 
lecture 12
lecture 12lecture 12
lecture 12
sajinsc
 
lecture 11
lecture 11lecture 11
lecture 11
sajinsc
 

Mais de sajinsc (20)

lecture 30
lecture 30lecture 30
lecture 30
 
lecture 29
lecture 29lecture 29
lecture 29
 
lecture 28
lecture 28lecture 28
lecture 28
 
lecture 27
lecture 27lecture 27
lecture 27
 
lecture 26
lecture 26lecture 26
lecture 26
 
lecture 25
lecture 25lecture 25
lecture 25
 
lecture 24
lecture 24lecture 24
lecture 24
 
lecture 23
lecture 23lecture 23
lecture 23
 
lecture 22
lecture 22lecture 22
lecture 22
 
lecture 21
lecture 21lecture 21
lecture 21
 
lecture 20
lecture 20lecture 20
lecture 20
 
lecture 19
lecture 19lecture 19
lecture 19
 
lecture 18
lecture 18lecture 18
lecture 18
 
lecture 17
lecture 17lecture 17
lecture 17
 
lecture 16
lecture 16lecture 16
lecture 16
 
lecture 15
lecture 15lecture 15
lecture 15
 
lecture 14
lecture 14lecture 14
lecture 14
 
lecture 13
lecture 13lecture 13
lecture 13
 
lecture 12
lecture 12lecture 12
lecture 12
 
lecture 11
lecture 11lecture 11
lecture 11
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Último (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 

lecture 8

  • 1. CS 332: Algorithms Quicksort
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Analyzing Quicksort: Average Case Note: leaving the same recurrence as the book What are we doing here? The recurrence to be solved What are we doing here? What are we doing here? Plug in inductive hypothesis Expand out the k=0 case 2b/n is just a constant, so fold it into  (n)
  • 20. Analyzing Quicksort: Average Case What are we doing here? What are we doing here? Evaluate the summation: b+b+…+b = b (n-1) The recurrence to be solved Since n-1<n, 2b(n-1)/n < 2b What are we doing here? Distribute the summation This summation gets its own set of slides later
  • 21. Analyzing Quicksort: Average Case How did we do this? Pick a large enough that an/4 dominates  (n)+b What are we doing here? Remember, our goal is to get T(n)  an lg n + b What the hell? We’ll prove this later What are we doing here? Distribute the (2a/n) term The recurrence to be solved
  • 22.
  • 23. Tightly Bounding The Key Summation What are we doing here? The lg k in the second term is bounded by lg n What are we doing here? Move the lg n outside the summation What are we doing here? Split the summation for a tighter bound
  • 24. Tightly Bounding The Key Summation The summation bound so far What are we doing here? The lg k in the first term is bounded by lg n/2 What are we doing here? lg n/2 = lg n - 1 What are we doing here? Move ( lg n - 1 ) outside the summation
  • 25. Tightly Bounding The Key Summation The summation bound so far What are we doing here? Distribute the ( lg n - 1 ) What are we doing here? The summations overlap in range; combine them What are we doing here? The Guassian series
  • 26. Tightly Bounding The Key Summation The summation bound so far What are we doing here? Rearrange first term, place upper bound on second What are we doing? X Guassian series What are we doing? Multiply it all out
  • 27. Tightly Bounding The Key Summation