Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A sparse array is an array of data in which many elements have a value of zero. This is in contrast to a dense array, where most of the elements have non-zero values or are “full” of numbers. A sparse array may be treated differently than a dense array in digital data handling.
As with other types of sparse information resources, such as, for example, a sparse matrix, a sparse array may be compressed or truncated to fit a particular storage space. Rather than holding all of the actual zero values in variables, the array could simply point to the number of zero values in a sequence or otherwise compress the array’s data storage.
In computer science, a sparse array is, in some ways, handled operationally just like any other array – an array is a set of variables each holding a specific value. Arrays are labeled in ways that show their sequence – for example, in common computer language notation, an array of six variables named A(6) can hold values for A1, A2, A3, A4, A5 and A6. If more than three or four of these values are zero, the array is said to be “sparse.”