It is from Bellman, Held and Karp [0] and has O*(2^n) complexity for both space and time. It is quite simple and based on the idea that<p>&quot;Every subpath of a path of minimum distance is itself of minimum distance.&quot;<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Held%E2%80%93Karp_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Held%E2%80%93Karp_algorithm</a>