SlideShare a Scribd company logo
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

More Related Content

What's hot

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
 
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
 
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
Lilyana Vankova
 

What's hot (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
 

Viewers also liked

Skiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksortSkiena algorithm 2007 lecture08 quicksort
Skiena algorithm 2007 lecture08 quicksort
zukun
 
lecture 6
lecture 6lecture 6
lecture 6
sajinsc
 
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
Dheeraj Kataria
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
Aakash deep Singhal
 

Viewers also liked (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
 

Similar to lecture 7

lecture 8
lecture 8lecture 8
lecture 8
sajinsc
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sorting
zukun
 
Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquer
chidabdu
 
Quicksort analysis
Quicksort analysisQuicksort analysis
Quicksort analysis
Premjeet Roy
 
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
 

Similar to 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
 

More from 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
 

More from 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
 

Recently uploaded

Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
YibeltalNibretu
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 

Recently uploaded (20)

Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 

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