Question: Edit this code so that it will solve the TSP using the brute-force method. Dont forget to return to V0. Be sure to print (one

Edit this code so that it will solve the TSP using the brute-force method. Dont forget to return to V0. Be sure to print (one of) the cheapest path(s) and its corresponding cost.
Using the Timing command in Mathematica, compute the speed of the brute force algorithm for n = 1, 2, 3, 4. Include these times as comments in your code. Recall that numN odes = n + 1.
Everything needs to be in Mathematica's language.
Given Code
In[8]:= SP = {{1}}; LP = {};
numNodes = 5;
LPpathLengths = 0;
While[LPpathLengths
During evaluation of In[8]:= SP = {{1}}
During evaluation of In[8]:= LP = {{1,2},{1,3},{1,4},{1,5}}
During evaluation of In[8]:=
During evaluation of In[8]:= SP = {{1,2},{1,3},{1,4},{1,5}}
During evaluation of In[8]:= LP = {{1,2,3},{1,2,4},{1,2,5},{1,3,2},{1,3,4},{1,3,5},{1,4,2},{1,4,3},{1,4,5},{1,5,2},{1,5,3},{1,5,4}}
During evaluation of In[8]:=
During evaluation of In[8]:= SP = {{1,2,3},{1,2,4},{1,2,5},{1,3,2},{1,3,4},{1,3,5},{1,4,2},{1,4,3},{1,4,5},{1,5,2},{1,5,3},{1,5,4}}
During evaluation of In[8]:= LP = {{1,2,3,4},{1,2,3,5},{1,2,4,3},{1,2,4,5},{1,2,5,3},{1,2,5,4},{1,3,2,4},{1,3,2,5},{1,3,4,2},{1,3,4,5},{1,3,5,2},{1,3,5,4},{1,4,2,3},{1,4,2,5},{1,4,3,2},{1,4,3,5},{1,4,5,2},{1,4,5,3},{1,5,2,3},{1,5,2,4},{1,5,3,2},{1,5,3,4},{1,5,4,2},{1,5,4,3}}
During evaluation of In[8]:=
During evaluation of In[8]:= SP = {{1,2,3,4},{1,2,3,5},{1,2,4,3},{1,2,4,5},{1,2,5,3},{1,2,5,4},{1,3,2,4},{1,3,2,5},{1,3,4,2},{1,3,4,5},{1,3,5,2},{1,3,5,4},{1,4,2,3},{1,4,2,5},{1,4,3,2},{1,4,3,5},{1,4,5,2},{1,4,5,3},{1,5,2,3},{1,5,2,4},{1,5,3,2},{1,5,3,4},{1,5,4,2},{1,5,4,3}}
During evaluation of In[8]:= LP = {{1,2,3,4,5},{1,2,3,5,4},{1,2,4,3,5},{1,2,4,5,3},{1,2,5,3,4},{1,2,5,4,3},{1,3,2,4,5},{1,3,2,5,4},{1,3,4,2,5},{1,3,4,5,2},{1,3,5,2,4},{1,3,5,4,2},{1,4,2,3,5},{1,4,2,5,3},{1,4,3,2,5},{1,4,3,5,2},{1,4,5,2,3},{1,4,5,3,2},{1,5,2,3,4},{1,5,2,4,3},{1,5,3,2,4},{1,5,3,4,2},{1,5,4,2,3},{1,5,4,3,2}}
During evaluation of In[8]:=
During evaluation of In[8]:= Final Output =
Out[13]= {{1, 2, 3, 4, 5}, {1, 2, 3, 5, 4}, {1, 2, 4, 3, 5}, {1, 2, 4, 5, 3}, {1, 2, 5, 3, 4}, {1, 2, 5, 4, 3}, {1, 3, 2, 4, 5}, {1, 3, 2, 5, 4}, {1, 3, 4, 2, 5}, {1, 3, 4, 5, 2}, {1, 3, 5, 2, 4}, {1, 3, 5, 4, 2}, {1, 4, 2, 3, 5}, {1, 4, 2, 5, 3}, {1, 4, 3, 2, 5}, {1, 4, 3, 5, 2}, {1, 4, 5, 2, 3}, {1, 4, 5, 3, 2}, {1, 5, 2, 3, 4}, {1, 5, 2, 4, 3}, {1, 5, 3, 2, 4}, {1, 5, 3, 4, 2}, {1, 5, 4, 2, 3}, {1, 5, 4, 3, 2}}
V, 5?011 1 16 60 V, 5?011 1 16 60
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
