Travelling salesman problem brute force

pls can any1 help me with the logic of the brute force approach for this problem I mean the recursive code that is optimised to get dp