I am currently developing a programming language in C, and I want to allow users to create apparently "unlimited" arrays with numerical indices without sacrificing performance in the process. For example, table [1000000000]
would ideally be creatable and accessible in an instant without the memory overhead of a table of 1,000,000,000 items, 999,999,999 of which were unused; but the array would also perform well when table [n]
was defined for, say, 1 ≤ n ≤ 1000000.
Do you have suggestions for the implementation of such an array-handling system?