Recurrence relation
for it in ed : NEW_LINE INDENT dis1 [ it [ 1 ] ] = min ( dis1 [ it [ 1 ] ] , dis [ it [ 0 ] ] + it [ 2 ] ) NEW_LINE DEDENT for i in range ( n + 1 ) : NEW_LINE INDENT dis [ i ] = dis1 [ i ] NEW_LINE DEDENT