Mapping with continguous ranges of keys

Terry Reedy tjreedy at
Thu Dec 15 15:48:22 EST 2016

On 12/15/2016 12:27 PM, Thomas Nyberg wrote:
> On 12/15/2016 09:06 AM, Steve D'Aprano wrote:
>> Has anyone dealt with data like this and could give a recommendation
>> of the
>> right data structure to use?
> I haven't dealt with a data structure exactly like this, but it's
> basically a sparse array.

A sparse array has at least half missing values.  This one has none on 
the defined domain, but contiguous dupicates.

 > (I'm sure it has a name somewhere in the
> academic literature, but I couldn't find it with a quick search right
> now...)

'Sparse array' is the name for sparse arrays.  I cannot think of one for 
blocks of duplicates.

Terry Jan Reedy

More information about the Python-list mailing list