SlideShare uma empresa Scribd logo
1 de 38
CS 332: Algorithms Quicksort
Homework 2 ,[object Object],[object Object],[object Object]
Review: Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object]
Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object]
Quicksort Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Partition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Partition In Words ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Note: slightly different from book’s  partition()
Partition Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Illustrate on  A = {5, 3, 2, 6, 4, 1, 3, 7}; What is the running time of  partition() ?
Partition Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],partition()  runs in O(n) time
Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Quicksort ,[object Object],[object Object],[object Object],[object Object]
Improving Quicksort ,[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],Use n instead of O(n)  for convenience ( how? )
Analyzing Quicksort: Average Case ,[object Object],[object Object],[object Object],[object Object]
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],[object Object]
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],[object Object],[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

Universe (Twin)
Universe (Twin)Universe (Twin)
Universe (Twin)omsai_999
 
Introduction to the Keldysh non-equlibrium Green's function technique
Introduction to the Keldysh non-equlibrium Green's function techniqueIntroduction to the Keldysh non-equlibrium Green's function technique
Introduction to the Keldysh non-equlibrium Green's function techniqueInon Sharony
 
Modeling biased tracers at the field level
Modeling biased tracers at the field levelModeling biased tracers at the field level
Modeling biased tracers at the field levelMarcel Schmittfull
 
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...Global HeavyLift Holdings, LLC
 
Origin of Universe (Twin)
Origin of Universe (Twin)Origin of Universe (Twin)
Origin of Universe (Twin)omsai_999
 
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...Global HeavyLift Holdings, LLC
 
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...Global HeavyLift Holdings, LLC
 
D. Mladenov - On Integrable Systems in Cosmology
D. Mladenov - On Integrable Systems in CosmologyD. Mladenov - On Integrable Systems in Cosmology
D. Mladenov - On Integrable Systems in CosmologySEENET-MTP
 
Lecture 14 maxwell-boltzmann distribution. heat capacities
Lecture 14   maxwell-boltzmann distribution. heat capacitiesLecture 14   maxwell-boltzmann distribution. heat capacities
Lecture 14 maxwell-boltzmann distribution. heat capacitiesAlbania Energy Association
 
Paolo Creminelli "Dark Energy after GW170817"
Paolo Creminelli "Dark Energy after GW170817"Paolo Creminelli "Dark Energy after GW170817"
Paolo Creminelli "Dark Energy after GW170817"SEENET-MTP
 
SMB_2012_HR_VAN_ST-last version
SMB_2012_HR_VAN_ST-last versionSMB_2012_HR_VAN_ST-last version
SMB_2012_HR_VAN_ST-last versionLilyana Vankova
 
Talk given at the Workshop in Catania University
Talk given at the Workshop in Catania University Talk given at the Workshop in Catania University
Talk given at the Workshop in Catania University Marco Frasca
 

Mais procurados (20)

Universe (Twin)
Universe (Twin)Universe (Twin)
Universe (Twin)
 
Fdtd ppt for mine
Fdtd ppt   for mineFdtd ppt   for mine
Fdtd ppt for mine
 
Introduction to the Keldysh non-equlibrium Green's function technique
Introduction to the Keldysh non-equlibrium Green's function techniqueIntroduction to the Keldysh non-equlibrium Green's function technique
Introduction to the Keldysh non-equlibrium Green's function technique
 
Chris Sherlock's slides
Chris Sherlock's slidesChris Sherlock's slides
Chris Sherlock's slides
 
Modeling biased tracers at the field level
Modeling biased tracers at the field levelModeling biased tracers at the field level
Modeling biased tracers at the field level
 
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
 
Origin of Universe (Twin)
Origin of Universe (Twin)Origin of Universe (Twin)
Origin of Universe (Twin)
 
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...
Original Paper From Astrophysicist Dr. Andrew Beckwith (Journal of Modern Phy...
 
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
New Presentation From Astrophysicist Dr. Andrew Beckwith: "Detailing Coherent...
 
D. Mladenov - On Integrable Systems in Cosmology
D. Mladenov - On Integrable Systems in CosmologyD. Mladenov - On Integrable Systems in Cosmology
D. Mladenov - On Integrable Systems in Cosmology
 
Universe from nothing
Universe from nothingUniverse from nothing
Universe from nothing
 
LieGroup
LieGroupLieGroup
LieGroup
 
qlp
qlpqlp
qlp
 
discrete-hmm
discrete-hmmdiscrete-hmm
discrete-hmm
 
1416336962.pdf
1416336962.pdf1416336962.pdf
1416336962.pdf
 
Lecture 14 maxwell-boltzmann distribution. heat capacities
Lecture 14   maxwell-boltzmann distribution. heat capacitiesLecture 14   maxwell-boltzmann distribution. heat capacities
Lecture 14 maxwell-boltzmann distribution. heat capacities
 
Paolo Creminelli "Dark Energy after GW170817"
Paolo Creminelli "Dark Energy after GW170817"Paolo Creminelli "Dark Energy after GW170817"
Paolo Creminelli "Dark Energy after GW170817"
 
F02402047053
F02402047053F02402047053
F02402047053
 
SMB_2012_HR_VAN_ST-last version
SMB_2012_HR_VAN_ST-last versionSMB_2012_HR_VAN_ST-last version
SMB_2012_HR_VAN_ST-last version
 
Talk given at the Workshop in Catania University
Talk given at the Workshop in Catania University Talk given at the Workshop in Catania University
Talk given at the Workshop in Catania University
 

Destaque

Skiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortSkiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortzukun
 
(Recursion)ads
(Recursion)ads(Recursion)ads
(Recursion)adsRavi Rao
 
Preparation Data Structures 02 recursion
Preparation Data Structures 02 recursionPreparation Data Structures 02 recursion
Preparation Data Structures 02 recursionAndres Mendez-Vazquez
 
lecture 6
lecture 6lecture 6
lecture 6sajinsc
 
3.8 quicksort 04
3.8 quicksort 043.8 quicksort 04
3.8 quicksort 04Krish_ver2
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)kurubameena1
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueRai University
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursionAbdullah Al-hazmy
 
Quicksort Presentation
Quicksort PresentationQuicksort Presentation
Quicksort Presentationirdginfo
 
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIATypes Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIADheeraj Kataria
 
Quicksort: illustrated step-by-step walk through
Quicksort: illustrated step-by-step walk throughQuicksort: illustrated step-by-step walk through
Quicksort: illustrated step-by-step walk throughYoshi Watanabe
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 

Destaque (16)

Skiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortSkiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksort
 
Algorithm - Mergesort & Quicksort
Algorithm - Mergesort & Quicksort Algorithm - Mergesort & Quicksort
Algorithm - Mergesort & Quicksort
 
(Recursion)ads
(Recursion)ads(Recursion)ads
(Recursion)ads
 
Quicksort
QuicksortQuicksort
Quicksort
 
Preparation Data Structures 02 recursion
Preparation Data Structures 02 recursionPreparation Data Structures 02 recursion
Preparation Data Structures 02 recursion
 
lecture 6
lecture 6lecture 6
lecture 6
 
3.8 quicksort 04
3.8 quicksort 043.8 quicksort 04
3.8 quicksort 04
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
 
Lists
ListsLists
Lists
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Quicksort Presentation
Quicksort PresentationQuicksort Presentation
Quicksort Presentation
 
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIATypes Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
 
Quicksort: illustrated step-by-step walk through
Quicksort: illustrated step-by-step walk throughQuicksort: illustrated step-by-step walk through
Quicksort: illustrated step-by-step walk through
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 

Semelhante a lecture 7

lecture 8
lecture 8lecture 8
lecture 8sajinsc
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingzukun
 
Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquerchidabdu
 
CSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxCSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxDeepakM509554
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquerVikas Sharma
 
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 V2S.Shayan Daneshvar
 
Quicksort analysis
Quicksort analysisQuicksort analysis
Quicksort analysisPremjeet Roy
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
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 1Deepak John
 
Top school in noida
Top school in noidaTop school in noida
Top school in noidaEdhole.com
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms IiSri Prasanna
 

Semelhante a lecture 7 (20)

lecture 8
lecture 8lecture 8
lecture 8
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sorting
 
Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquer
 
lecture8.ppt
lecture8.pptlecture8.ppt
lecture8.ppt
 
CSE680-07QuickSort.pptx
CSE680-07QuickSort.pptxCSE680-07QuickSort.pptx
CSE680-07QuickSort.pptx
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
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
 
Quicksort analysis
Quicksort analysisQuicksort analysis
Quicksort analysis
 
Lec10
Lec10Lec10
Lec10
 
big_oh
big_ohbig_oh
big_oh
 
Merge sort and quick sort
Merge sort and quick sortMerge sort and quick sort
Merge sort and quick sort
 
Lec10
Lec10Lec10
Lec10
 
Cis435 week02
Cis435 week02Cis435 week02
Cis435 week02
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
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
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Top school in noida
Top school in noidaTop school in noida
Top school in noida
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 

Mais de sajinsc

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

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

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
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)Jisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
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.pptxDr. Ravikiran H M Gowda
 
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.christianmathematics
 
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 PractiseAnaAcapella
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
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 17Celine George
 
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.pdfNirmal Dwivedi
 
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.pdfPoh-Sun Goh
 
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 POSCeline George
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Último (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
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)
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
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
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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
 
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
 
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
 
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
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 

lecture 7

  • 1. CS 332: Algorithms Quicksort
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. 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)
  • 31. 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
  • 32. 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
  • 33.
  • 34. 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
  • 35. 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
  • 36. 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
  • 37. 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
  • 38. Tightly Bounding The Key Summation