Constant time dynamic programming on directed reconfigurable networks