Professional Documents
Culture Documents
Solves a problem by
dividing it into smaller
subproblems, solving each Solves a problem by breaking
Finds the best solution
subproblem independently, it down into smaller
GOAL among a set of possible
and then combining the subproblems and solving
.solutions
solutions to the subproblems .each subproblem recursively
to solve the original
.problem
5
Comparison
Greedy Divide & coquer Dynamic programming
May or may not provide the May or may not provide the Guarantees the optimal
Optimal solution
.optimal solution .optimal solution .solution
:Examples
Fractional Knapsack proble ,Merge sort :Examples ,0/1 Knapsack :Examples
m ,Quick sort ,All pair shortest path
Examples Strassen’s
, .Matrix-chain multiplication
,Activity selection problem . matrix multiplication
.Job sequencing problem
6
the main differences among these algorithms are their approach,
Summary goal, time and space complexity, and their ability to provide the
optimal solution. Greedy algorithm and divide and conquer
algorithm are generally faster and simpler, but may not always
provide the optimal solution, while dynamic programming algorithm
guarantees the optimal solution but is slower and more complex.
7
Thank You
Nasser Saleh
2023-MSCS-28