Minimum Absolute Difference in an Array

  • + 0 comments

    Probably because if you locate some local minimum distance, that's also the global minimum until you find something better. In other words, if you find a minimum, that's optimal and you take it. In contrast, finding a shortest route in a graph doesn't work if you greedily always take the shortest route at every juncture, since sometimes taking a longer route in the short term offers a better path overall.