Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Code is needed. Need help finishing the code for this assignment. def __init__(self, name): self.name = name self.nextNodes = [] self.paths = [] def

Python Code is needed. Need help finishing the code for this assignment.

image text in transcribed

def __init__(self, name): self.name = name self.nextNodes = [] self.paths = []

def add_nextNodes(self, nextNode, path): self.nextNodes.append(nextNode) self.paths.append(pATH)

def f(self) return 'hello world'

A = Node("A") B = Node("B") C = Node("C") D = Node("D") E = Node("E") F = Node("F") G = Node("G") H = Node("H") I = Node("I") J = Node("J") K = Node("K") L = Node("L") M = Node("M") N = Node("N") A.add_nextNodes("B", 2) B.add_nextNodes("D", 2) C.add_nextNodes("A", 4) C.add_nextNodes("E", 2) C.add_nextNodes("F", 2) D.add_nextNodes("B", 2) D.add_nextNodes("G", 3) D.add_nextNodes("H", 6) E.add_nextNodes("F", 4) E.add_nextNodes("C", 2) E.add_nextNodes("K", 4) F.add_nextNodes("E", 4) F.add_nextNodes("C", 2) F.add_nextNodes("G", 6) F.add_nextNodes("J", 2) G.add_nextNodes("F", 6) G.add_nextNodes("I", 3) H.add_nextNodes("D", 6) H.add_nextNodes("I", 2) H.add_nextNodes("L", 3) I.add_nextNodes("G", 3) I.add_nextNodes("J", 6) J.add_nextNodes("L", 5) J.add_nextNodes("I", 6) J.add_nextNodes("M", 3) K.add_nextNodes("M", 3) L.add_nextNodes("H", 3) L.add_nextNodes("J", 5) L.add_nextNodes("N", 4) M.add_nextNodes("J", 3) M.add_nextNodes("K", 3) N.add_nextNodes("L", 4) N.add_nextNodes("M", 2)

Using a linked list, and the list of nodes (A-N), what is the shortest possible route that visits each city and returns to the origin city (without visiting each city)? Construct a linked list resembling the node A through N and then plot the fastest course. You will have to create an abstract node class 6 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago

Question

1. What are the marketing implications of this situation?

Answered: 1 week ago