Katkat

Design Data Structure for Sparse Matrices Operations

PinterestData Scientist · Onsite

Last updated

This question evaluates a candidate's ability to design efficient data structures and implement algorithms for sparse matrix storage and operations, emphasizing space-efficient representations, matrix arithmetic, and computational complexity reasoning.

Scenario

Analytics engine stores extremely sparse numeric matrices.

Question

Design a data structure to store two sparse matrices and implement print(), add(A,B) and multiply(A,B). Discuss complexity for each operation.

Hints

Use dictionary-of-keys or CSR; pre-index rows and columns to speed multiplication.