This question evaluates understanding of sparse data representations, efficient algorithm design for vector operations, and rigorous time and space complexity analysis.

Design a SparseVector class initialized from an integer array where many entries may be zero. Implement dotProduct(SparseVector other) to compute the dot product efficiently when vectors are sparse—faster than O(n) over all positions. Describe the data structures you would use (e.g., index-value maps or compressed lists), handle vectors of different sparsity patterns, and analyze time and space complexity.