Greedy Successes

Subpage of Algorithms

Algorithms explained with intuition, formal models, proof sketches, and implementation tradeoffs.

Here are some scenarios where can use Greedy algorithms directly. These are classified into a few categories:

Optimization

Optimisation with absolute differences

When we need to find a target \(T\) in an array \(a\) that minimises cost, we can use the following heuristics:

  • Problems where the cost is \(∑∣a_i−T∣\) → minimized by the median.
  • Problems where the cost is \(∑(a_i−T)^2\) → minimized by the mean.

This extends to the following more general case of:

  • Sum of distances in Manhattan metric → median (per dimension)
  • Sum of distances in Euclidean metric → mean (per dimension)

/ Continue

Follow the technical trail.

Use the dense notes as the source material, then move through the guided route, writing, or project proof when you want a cleaner entry point.