On 9/21/17 3:24 PM, Timon Gehr wrote:

This is a good alternative, maybe arrange it like this:

dfs(a + 1, b); dfs(a, b + 1);
dfs(a - 1, b); dfs(a, b - 1);

Yes, better!

Just need to make sure no code is duplicated. (For example, there could be more work to do in each loop iteration, and then you'd need to use a local function.)

Hm... I suppose you would do that work at the beginning of dfs, like you check the limits?

-Steve

Reply via email to