Do I need a sparse array or something else?

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,160
I have an application that stores values in an array but not all locations will be used and I don't know in advance which, or how many will be used though I will know a maximum size.. The full array occupies too much memory so I need a way to reduce this.

What would you reccomend for this situation?
 

WBahn

Joined Mar 31, 2012
27,496
A sparse array might be a way to go, or a hash table is another option. It depends on the details and what aspects are important and which can be relaxed.
 
Top