when fixing the cow in the stall we always start from the first stall why???
Doubt regarding logic
Hi!
We’ve to find the largest minimum distance between 2 cows, so we are placing the 1st stall because we need to maximise the minimum distance, placing the 1st cow in 1st stall gives us maximum options to do that, so there is no harm in doing that.
Just like we take search space from 0 (all cows in same stall) or n-1 (2 cows at 1st and last position). Placing the 1st cow in 1st stall gives us whole lot of options from 0 to n-1. If we do NOT place the 1st cow in 1st stall then, we may not get the largest distance.