Sparse (1) - Something that is sparse has values scattered throughout it, such as an array "a" with indices from 1 to 100 which only has values in 4 places:

a[3] = "Red"

a[50] = "Green"

a[72] = "Blue"

a[99] = "Yellow"

Sparse (2) - A programming construct that is said to be "sparse" may actually only have data storage locations for those indices which have values. For example, the array referred to above would presently only need 4 data storage locations, even though there are potentially 100 datums: [ "Red", "Green", "Blue", "Yellow" ]

Often, a sparse data structure is not 100% efficient since the index must be stored along with the datum: [ 3:"Red", 50:"Green", 72:"Blue", 99:"Yellow" ]

RDBMS tables are well suited to storing "sparse arrays" of things, where the index is the primary key, and the value is every other field of the record.

Typical Multi-dimensioned arrays are not sparse(2) because math is used to identify the memory location where a particular datum is stored. (see Many Dimensioned Array Class for the easily-extended math for up to 5 dimensions)

Contributors: ?wgcs

Category Definitions

( Topic last updated: 2004.04.24 05:05:17 PM )