Q8Comprehension5 Marks13 Apr 2025
Passage
Based on the above data, answer the given subquestions.
The following table contains information regarding books in a library. Each entry in the table corresponds to a book and is authored by at least two authors. There is a pool of n authors, each author being assigned a unique index between 0 and n - 1. There are M books in total.
The table is represented by a dictionary named books, with the keys as serial numbers and values as the corresponding list of authors. Assume that books has already been computed. For example, we have: books[0] = [0, 2, 3].
The following pseudocode generates a graph G from books. Each node corresponds to an author. For two different authors j and k, what does the value matrix[j][k] represent at the end of the execution?
```
matrix = createMatrix(n, n)
foreach i in keys(books){
foreach j in books[i]{
foreach k in books[i]{
if(j != k){
matrix[j][k] = matrix[j][k] + 1
}
}
}
}
```