Greedy Algorithms "Take What You Can Get Now" Strategy: Examples
Greedy Algorithms "Take What You Can Get Now" Strategy: Examples
2. Divide-and-Conquer, Decrease-and-Conquer
These are methods of designing algorithms that (informally)
proceed as follows:
Given an instance of the problem to be solved, split this into several
smaller sub-instances (of the same problem), independently solve
each of the sub-instances and then combine the sub-instance
solutions so as to yield a solution for the original instance.
With the divide-and-conquer method the size of the problem
instance is reduced by a factor (e.g. half the input size), while with
the decrease-and-conquer method the size is reduced by a
constant.
Examples of divide-and-conquer algorithms:
3. Dynamic Programming
One disadvantage of using Divide-and-Conquer is that the process
of recursively solving separate sub-instances can result in the same
computations being performed repeatedly sinceidentical subinstances may arise.
The idea behind dynamic programming is to avoid this pathology by
obviating the requirement to calculate the same quantity twice.
The method usually accomplishes this by maintaining a table of
sub-instance results.
Dynamic Programming is a Bottom-Up Technique in which the
smallest sub-instances areexplicitly solved first and the results of