Skip to main content
/Concepts/Greedy vs DP
1 / 8
Speed
ENES
/
Big O NotationRecursionTwo PointersSliding WindowSpace ComplexityMemoizationGreedy vs DP
StackQueueLinked ListHash TableBinary Search TreeHeap
Bubble SortSelection SortInsertion SortQuick SortMerge SortHeap SortCounting SortRadix SortShell Sort
Binary SearchLinear SearchJump SearchInterpolation Search
Breadth-First SearchDepth-First SearchDijkstra's AlgorithmPrim's AlgorithmTopological Sort
Fibonacci DPKnapsack 0/1Longest Common Subsequence
N-Queens ProblemSudoku SolverMaze Pathfinding
Tower of Hanoi
38 algorithms·by midudev
Greedy vs DP
Greedy
target = 8
coins:
1
4
6
Step 1:Coin Change: make 8 using coins [1, 4, 6] with fewest coins. Let's try Greedy first.
Variables
target==8
coins==[1, 4, 6]
approach==Greedy