ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

1

Transcript of ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Page 1: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD: II

Partha P ChakrabartiIndian Institute of Technology Kharagpur

Page 2: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Algorithm Design by Recursion Transformation1. Initial Solution

a. Recursive Definition – A set of Solutionsb. Inductive Proof of Correctnessc. Analysis Using Recurrence Relations

2. Exploration of Possibilitiesa. Decomposition or Unfolding of the Recursion Treeb. Examination of Structures formedc. Re-composition Properties

3. Choice of Solution & Complexity Analysisa. Balancing the Split, Choosing Pathsb. Identical Sub-problems

4. Data Structures & Complexity Analysisa. Remembering Past Computation for Futureb. Space Complexity

5. Final Algorithm & Complexity Analysisa. Traversal of the Recursion Treeb. Pruning

6. Implementationa. Available Memory, Time, Quality of Solution, etc

Algorithms and Programs Pseudo-Code Algorithms + Data Structures = Programs Initial Solutions + Analysis + Solution

Refinement + Data Structures = FinalAlgorithm

Use of Recursive Definitions as InitialSolutions

Recurrence Equations for Proofs andAnalysis

Solution Refinement through RecursionTransformation and Traversal

Data Structures for saving pastcomputation for future use

Partha P
Partha P
Partha P
Page 3: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Basics of Divide & Conquer Method

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 4: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Sorting & Searching Problems

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 5: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Sorting by Max Removal

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 6: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Sorting by Max Removal: Data Structure

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 7: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Sorting by Max Removal: Finalization

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 8: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Insertion Sort

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 9: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Insertion Sort: Data Structure

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 10: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Insertion Sort: Finalization

Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Partha P
Page 11: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Overview of Algorithm Design 1. Initial Solution

a. Recursive Definition – A set of Solutionsb. Inductive Proof of Correctnessc. Analysis Using Recurrence Relations

2. Exploration of Possibilitiesa. Decomposition or Unfolding of the Recursion Treeb. Examination of Structures formedc. Re-composition Properties

3. Choice of Solution & Complexity Analysisa. Balancing the Split, Choosing Pathsb. Identical Sub-problems

4. Data Structures & Complexity Analysisa. Remembering Past Computation for Futureb. Space Complexity

5. Final Algorithm & Complexity Analysisa. Traversal of the Recursion Treeb. Pruning

6. Implementationa. Available Memory, Time, Quality of Solution, etc

1. Core Methodsa. Divide and Conquerb. Greedy Algorithmsc. Dynamic Programmingd. Branch-and-Bounde. Analysis using Recurrencesf. Advanced Data Structuring

2. Important Problems to be addresseda. Sorting and Searchingb. Strings and Patternsc. Trees and Graphsd. Combinatorial Optimization

3. Complexity & Advanced Topicsa. Time and Space Complexityb. Lower Boundsc. Polynomial Time, NP-Hardd. Parallelizability, Randomization

Page 12: ALGORITHM DESIGN USING DIVIDE & CONQUER METHOD

Thank you

Any Questions?