Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ype a question for help | (General) Sub EX8 2 2NearestNeighbor 0 Dim iSeg As Int

ID: 3735201 • Letter: Y

Question

ype a question for help | (General) Sub EX8 2 2NearestNeighbor 0 Dim iSeg As Integer, i As Integer, As Integer, 1Start s Integer TSP bjects Dim nCities As Integer, novAt As Integer, nextc Dim intTD As Integer, intMaxDist As Integer, intMinDist As Integer As Integer Dim rngA As Range Dim DistAs Integer Dim binVisited) As Boolean Set rngA -Range("A3") With enga Find nCities zedim DiStO and blnVisicedo read Distance mateix from Excel, assign to DLt 'Pinding the Jongest distance and assign to variable intMaxDE HEste Output Headings AnEAAe EA tance neT

Explanation / Answer

Formula for B12

=INDEX($B$4:$F$8,B10,B11)

Formula for B13

=SUM(B12:F12)

Sub EXE_2_2NearestNeighbour()
Dim iSeg As Integer, i As Integer, j As Integer, iStart As Integer
Dim nCities As Integer, nowAt As Integer, intMinDist As Integer
Dim intTD As Integer, intMaxDist As Integer, intMinDist As Integer
Dim rngA As Range

Dim Dist() As Integer
Dim blnVisited() As Boolean

Set rngA = Range("A3")

With rngA
.Offset(nCities + 2, 0) = "From"
.Offset(nCities + 3, 0) = "To"
.Offset(nCities + 4, 0) = "Distance"
.Offset(nCities + 5, 0) = "Tot Distance"
End Sub

Option Explicit
Option Base 1

Sub Ex8_2_1GenerateDistanceMatrix()
Dim strAns As String
Dim intNCities As Integer, i As Integer, j As Integer
  
wsDistance.Activate
  
  
ActiveSheet.UsedRange.Clear
  
With Range("A3")
  
End With
  
End Sub