Chapter 8: Problem 22
A sparse array is a sequence of numbers in which most entries are zero. An efficient way of storing a sparse array is a dictionary in which the keys are the positions with nonzero values, and the values are the corresponding values in the sequence. For example, the sequence 00000400029 would be represented with the dictionary [ 5: 4, 9: 2, 10: 9] Write a function sparseArraysun, whose arguments are two such dictionaries a and \(b\), that produces a sparse array that is the vector sum; that is, the result's value at position i is the sum of the values of a and b at position \(i\).
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.