Why does the greedy coin change algorithm not work for some coin sets?

A set which forms a matroid (https://en.wikipedia.org/wiki/Matroid) can be used to solve the coin changing problem by using greedy approach. In brief, a matroid is an ordered pair M = (S,l) satisfying the following conditions: S is a finite nonempty set l is a nonempty family of subsets of S, called the independent subsets,such that … Read more

Why doesn’t Dijkstra’s algorithm work for negative weight edges?

Recall that in Dijkstra’s algorithm, once a vertex is marked as “closed” (and out of the open set) – the algorithm found the shortest path to it, and will never have to develop this node again – it assumes the path developed to this path is the shortest. But with negative weights – it might … Read more