SlideShare ist ein Scribd-Unternehmen logo
1 von 56
CS 332: Algorithms Solving Recurrences Continued The Master Theorem Introduction to heapsort
Review: Merge Sort ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review: Analysis of Merge Sort ,[object Object],[object Object],[object Object],MergeSort(A, left, right) { T(n) if (left < right) {  (1) mid = floor((left + right) / 2);    (1) MergeSort(A, left, mid);   T(n/2) MergeSort(A, mid+1, right);   T(n/2) Merge(A, left, mid, right);    (n) } }
Review: Solving Recurrences ,[object Object],[object Object],[object Object]
Review: Solving Recurrences ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review: Solving Recurrences ,[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]
[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]
[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],[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],[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],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
The Master Theorem ,[object Object],[object Object],[object Object],[object Object]
The Master Theorem ,[object Object]
Using The Master Method ,[object Object],[object Object],[object Object],[object Object],[object Object]
Sorting Revisited ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],Heaps 16 14 10 8 7 9 3 2 4 1
[object Object],[object Object],Heaps 16 14 10 8 7 9 3 2 4 1 1 1 1 1 1
Heaps ,[object Object],16 14 10 8 7 9 3 2 4 1 A = = 16 14 10 8 7 9 3 2 4 1
Heaps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],16 14 10 8 7 9 3 2 4 1 A = = 16 14 10 8 7 9 3 2 4 1
Referencing Heap Elements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Heap Property ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Heap Height ,[object Object],[object Object]
Heap Operations: Heapify() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Heap Operations: Heapify() ,[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]
Heapify() Example 16 4 10 14 7 9 3 2 8 1 16 4 10 14 7 9 3 2 8 1 A =
Heapify() Example 16 4 10 14 7 9 3 2 8 1 16 10 14 7 9 3 2 8 1 A = 4
Heapify() Example 16 4 10 14 7 9 3 2 8 1 16 10 7 9 3 2 8 1 A = 4 14
Heapify() Example 16 14 10 4 7 9 3 2 8 1 16 14 10 4 7 9 3 2 8 1 A =
Heapify() Example 16 14 10 4 7 9 3 2 8 1 16 14 10 7 9 3 2 8 1 A = 4
Heapify() Example 16 14 10 4 7 9 3 2 8 1 16 14 10 7 9 3 2 1 A = 4 8
Heapify() Example 16 14 10 8 7 9 3 2 4 1 16 14 10 8 7 9 3 2 4 1 A =
Heapify() Example 16 14 10 8 7 9 3 2 4 1 16 14 10 8 7 9 3 2 1 A = 4
Heapify() Example 16 14 10 8 7 9 3 2 4 1 16 14 10 8 7 9 3 2 4 1 A =
Analyzing Heapify(): Informal ,[object Object],[object Object],[object Object]
Analyzing Heapify(): Formal ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Heapify(): Formal ,[object Object],[object Object],[object Object],[object Object],[object Object]
Heap Operations: BuildHeap() ,[object Object],[object Object],[object Object],[object Object],[object Object]
BuildHeap() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
BuildHeap() Example ,[object Object],4 1 3 2 16 9 10 14 8 7
Analyzing BuildHeap() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing BuildHeap(): Tight ,[object Object],[object Object],[object Object],[object Object],[object Object]
Heapsort ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Heapsort ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analyzing Heapsort ,[object Object],[object Object],[object Object]
Priority Queues ,[object Object],[object Object],[object Object],[object Object],[object Object]
Priority Queue Operations ,[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)
 
Signals Processing Assignment Help
Signals Processing Assignment HelpSignals Processing Assignment Help
Signals Processing Assignment Help
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Signals Processing Homework Help
Signals Processing Homework HelpSignals Processing Homework Help
Signals Processing Homework Help
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Basics & asymptotic notations
Basics & asymptotic notationsBasics & asymptotic notations
Basics & asymptotic notations
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Computational Complexity
Computational ComplexityComputational Complexity
Computational Complexity
 
Big o
Big oBig o
Big o
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
 
Lec9
Lec9Lec9
Lec9
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
big_oh
big_ohbig_oh
big_oh
 
Time complexity
Time complexityTime complexity
Time complexity
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 

Ähnlich wie lecture 4

lecture 5
lecture 5lecture 5
lecture 5sajinsc
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probabilitybryan111472
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
lecture 6
lecture 6lecture 6
lecture 6sajinsc
 
lecture 3
lecture 3lecture 3
lecture 3sajinsc
 
lecture 15
lecture 15lecture 15
lecture 15sajinsc
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquerVikas Sharma
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutionssubhashchandra197
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingzukun
 
Applicationof datastructures
Applicationof datastructuresApplicationof datastructures
Applicationof datastructuresHitesh Wagle
 
Applicationof datastructures
Applicationof datastructuresApplicationof datastructures
Applicationof datastructuresHitesh Wagle
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 

Ähnlich wie lecture 4 (20)

lecture 5
lecture 5lecture 5
lecture 5
 
L2
L2L2
L2
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probability
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
lecture 6
lecture 6lecture 6
lecture 6
 
2.pptx
2.pptx2.pptx
2.pptx
 
lecture 3
lecture 3lecture 3
lecture 3
 
lecture 15
lecture 15lecture 15
lecture 15
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Recurrences
RecurrencesRecurrences
Recurrences
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relation
 
L2
L2L2
L2
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sorting
 
Applicationof datastructures
Applicationof datastructuresApplicationof datastructures
Applicationof datastructures
 
Applicationof datastructures
Applicationof datastructuresApplicationof datastructures
Applicationof datastructures
 
3.pdf
3.pdf3.pdf
3.pdf
 
Recurrences
RecurrencesRecurrences
Recurrences
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 

Mehr von 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 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
 
lecture 10
lecture 10lecture 10
lecture 10sajinsc
 

Mehr von 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 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
 
lecture 10
lecture 10lecture 10
lecture 10
 

Kürzlich hochgeladen

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Kürzlich hochgeladen (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

lecture 4