For hash key's design for a diagonal matrix, it should be (j-i) as the key, right?

In Hash Table (sets and maps) section, where it talks about "Practical Application - Design the key", it mentions that sometimes, you'd need to map diagonal items into the same key.
It shows the key mapping as:
Diagonal order: (i,j) -> i - j
Assuming i is for rows, j is for columns (as it they are as such, in common notations), it should actually be mapped as:
Diagonal order: (i,j) -> j - i

Comments (3)