Allocating Memory for Sparsely Populated Arrays/Matrices
I'm using a program to allocate a good chunk of memory, upwards of a gig (1 GB) of ram for a 3 dimensional array. I'm looking for a way to make my allocation more efficient, if possible, because some of the indexes will contain 0 or null. I'd like to be able to discard the 0/null values and not allocate the space for them.
I've done some research and the only option I can find is linked lists. From what I gather, unless 50% or more of the indexes are 0, the linked list will allocate more space than originally allocated.
Any ideas would be greatly appreciated! Thanks!