Q9Comprehension5 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 creates adjacency matrix matrix2 of another graph H from books. For two different authors j and k, matrix2[j][k] represents the list of authors who have co-authored a book with both j and k. Choose the correct code fragment(s) to complete the following pseudocode.
```
matrix2 = createMatrix(n, n)
foreach j in rows(matrix2){
foreach k in columns(matrix2){
matrix2[j][k] = []
}
}
foreach i in keys(books){
foreach j in books[i]{
foreach k in books[i]{
foreach h in books[i]{
********************
* Fill the code *
********************
}
}
}
}
```