Dynamic programming approach to solve Travelling Sales Man problem