You are on page 1of 1

Complexity is a measure of the amount of time and/or space required by an algorithm

for an input of a given size.


Divide and Conquer (recursive) combines the solutions of sub-problems to obtain the
solution of the main problem.
Dynamic Programming (non-recursive) uses the result of the sub-problems to find
optimal solution of the main problem.
Sub Problems are independent in divide and conquer while interdependent in Dynamic
Programming.

In DP results of overlapping sub-problems are stored and not recomputed while in


divide and conquer this is not the case.

Spanning Tree
=============
1) Should contain all vertices.
2) Should have |V|-1 edges.

Number of possible STs = n^(n-2).

We create MSTs to avoid problems like deadlock, or for finding the lowest cost.

MST = 1) Prim's 2) Kruskal's

Running time for both: |E|lg|V|

NP
==
P means problems that can be verified and solved in polynomial time.
NP means problems that can only be verified in polynomial time but will take
exponential time or more to solve.

P = NP means that problems that can be verified

You might also like