Question 8
The following table contains information regarding authors from the “Library” dataset. Each row in the table corresponds to an author and list of publication years. There are n authors, each author is being assigned a unique index between 0 and n−1.
The table is represented by a dictionary named authors, with S.No as keys and lists of publication years as values. Assume that authors has already been computed. For example, we have: authors [0] = [1998,..., 2015]
isCommon(L1, L2) returns True if there are at least two common elements in lists L1 and L2.
M = createMatrix (n, n)foreach i in keys (authors) { foreach j in keys (authors) { if (i > j and isCommon(authors[i], authors[j])) { M[i][j] = 1 M[j][i] = 1 } }}
A = { }foreach i in rows (M) { count = 0 foreach j in columns (M) { if (M[i][j] ≠ 0) { count = count + 1 } } A[i]= count}What does an entry A[i] represent at the end of the execution of the pseudocode above?
Author A[i] has published books in i years
Author i has published books in A[i] years
Author A[i] has published at least two books in common years with i authors
Author i has published at least two books in common years with A[i] authors