Q2Comprehension5 Marks31 Aug 2025
Passage
Consider the following condensed version of the "Trains" dataset. There are a total of n stations, with stations being indexed from 0 to n − 1. There are M rows in the table. Each row contains information about a train that connects two stations without any stops in between.
Row r, tells us that train t departs from station i and arrives at station j after covering a distance of d kilometers without stopping at any intermediate station. Therefore, each train t will occupy multiple rows in this table.
This scenario is modeled as a graph and is represented by a matrix A. Each node in the graph corresponds to a station. Assume that the value of n is already given to you. Consider the following pseudocode.
]
```
S = {}
while(Table 1 has more rows){
Read the first row X in Table 1
S[X.SeqNo] = {}
S[X.SeqNo]["train"] = X.Train
S[X.SeqNo]["depart"] = X.Departure
S[X.SeqNo]["arrive"] = X.Arrival
S[X.SeqNo]["dist"] = X.Distance
Move X to Table 2
}
A = createMatrix(n, n)
foreach r in rows(A){
foreach c in columns(A){
A[r][c] = {}
}
}
foreach x in keys(S){
r = S[x]["depart"]
c = S[x]["arrive"]
t = S[x]["train"]
d = S[x]["dist"]
A[r][c][t] = d
}
```
If (i, j) is a pair of stations, which of the following statements about the dictionary A[i][j] are true?