Divide & Conquer Algorithms
202401160914
Status: #idea
Tags: DAA
Divide & Conquer Algorithms
Main Steps
- Dividing the problem into smaller sub-problems
- Solving these sub-problems
- Combining the solutions for those smaller sub-problems to solve the original problem
Note
Recursive algorithms are good candidates for distributed algorithms
Analysing D&C Algorithms
- We uses recurrence relations
-> Number of sub-problems -> is size of each sub-problem -> TODO
Longest Path Problem
Complete Graph
A graph where every node is connected to every other node by a unique edge.
- In a complete graph, there are at least
paths of length - Hence,
at least an exponential solution (because )
Coin Change Problem
- Given a value of
, find the minimum number of coins of fixed denominations, each with infinite supply - Key observations
- Optimisation problem
- Making change is possible i.e. solution exists (because 1 is there)
- Multiple solutions exist
- Question has 2 parts:
- Minimum number of coins required
- Which coins are part of the solution?
- This relation has overlapping sub-problems
Optimal Substructure Property
- Optimal solution to the original problem incorporates optimal solutions to the sub-problems
If
This does NOT apply to longest path