Leetcode DSA Algorithms

<< ---------------------------------------------------------------- >>

--- Last Modified: $= dv.current().file.mtime

Dynamic Programming

<< ---------------------------------------------------------------- >>

Approach:

to help visualize use direct asyclic graphs to make it easier.

  1. Find the Subproblem
  2. FInd the relationships between the subproblems

<< ---------------------------------------------------------------- >>

Greedy Method

<< ---------------------------------------------------------------- >>

Approach:

	def Gready(o, n): #o is the array with n being the length
		for i in range(n):
			x = select(a)
			if feasable(x):
				solution = solution + x

used for divisible things?? Knapsack problem but with fractional items is an example

<< ---------------------------------------------------------------- >>

Branch and Bound

<< ---------------------------------------------------------------- >>

1, 2, 8 1, 3, 5 3, 4, 6 3, 4, 5

1, 2, 8