0% found this document useful (0 votes)
4 views

Greedy Algorithm vs Divide and Conquer Algorithm vs Dynamic Algorithm

The document compares Greedy, Divide and Conquer, and Dynamic Programming algorithms, highlighting their approaches, efficiency, and optimality. It also contrasts Bellman Ford's and Dijkstra's algorithms, focusing on their handling of negative weights, time complexity, and scalability. Overall, it provides a clear distinction between these algorithmic strategies and their applications.

Uploaded by

Bhumi Lotankar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Greedy Algorithm vs Divide and Conquer Algorithm vs Dynamic Algorithm

The document compares Greedy, Divide and Conquer, and Dynamic Programming algorithms, highlighting their approaches, efficiency, and optimality. It also contrasts Bellman Ford's and Dijkstra's algorithms, focusing on their handling of negative weights, time complexity, and scalability. Overall, it provides a clear distinction between these algorithmic strategies and their applications.

Uploaded by

Bhumi Lotankar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Greedy Algorithm vs Divide and Conquer Algorithm vs Dynamic

Algorithm:

Sl.N Dynamic
o Greedy Algorithm Divide and conquer Programming

Follows Top-down Follows bottom-up


1 Follows Top-down approach approach approach

Used to solve optimization Used to solve decision Used to solve


2 problem problem optimization problem

The optimal solution is The solution of


generated without revisiting Solution of subproblem subproblems is
previously generated is computed computed once and
solutions; thus, it avoids the recursively more than stored in a table for
3 re-computation once. later use.

It is used to obtain a
solution to the given
problem, it does not
It may or may not generate aim for the optimal It always generates
4 an optimal solution. solution optimal solution.

5 Iterative in nature. Recursive in nature. Recursive in nature.

efficient and fast than divide less efficient and more efficient and
6 and conquer. slower. faster than greedy.

more memory is
required to store
extra memory is not some memory is subproblems for later
7 required. required. use.

Examples: 0/1
Examples: Fractional Examples: Merge sort, Knapsack,
Knapsack problem, Quick sort, All pair shortest path,
Activity selection problem, Strassen’s matrix Matrix-chain
8 Job sequencing problem. multiplication. multiplication.
Bellman Ford’s Algorithm Dijkstra’s Algorithm

Bellman Ford’s Algorithm works Dijkstra’s Algorithm may or may not work
when there is negative weight when there is negative weight edge. But
edge, it also detects the negative will definitely not work when there is a
weight cycle. negative weight cycle.

The result contains the vertices The result contains the vertices
which contains the information containing whole information about the
about the other vertices they are network, not only the vertices they are
connected to. connected to.

It can easily be implemented in a It can not be implemented easily in a


distributed way. distributed way.

It is more time consuming than


Dijkstra’s algorithm. Its time It is less time consuming. The time
complexity is O(VE). complexity is O(E logV).

Dynamic Programming approach


is taken to implement the Greedy approach is taken to implement
algorithm. the algorithm.

Bellman Ford’s Algorithm have


more overheads than Dijkstra’s Dijkstra’s Algorithm have less overheads
Algorithm. than Bellman Ford’s Algorithm.

Bellman Ford’s Algorithm have


less scalability than Dijkstra’s Dijkstra’s Algorithm have more scalability
Algorithm. than Bellman Ford’s Algorithm. .

You might also like