i need help making an infinite two dimensional array in c++, in other words, i have no clue how to do it....
can anyone help?
Name:
Anonymous2006-02-25 3:36
Well, if some of the language constructs are lazily evaluated, there is such a thing. Haskell, for example, allows such things.
I can't imagine how you'd do it in C++ though. Create your own ADT that behaves like an array but is a hash or tree internally? Probably implemented in the same way as a sparse array.
Name:
Anonymous2006-02-25 3:44
he probably wants a linked list, shitheads.
Name:
Anonymous2006-02-25 3:51
If you are allowed to use the STL then the vector template is your best friend.
Otherwise just make a linked list of linked lists.
Name:
Anonymous2006-02-25 4:47
>>4
A single linked list is a poor fit for a 2D sparse array.
>>5
I'm not certain a vector is a good choice.
a) It can't handle arbitrary-length integers
b) Sucks for sparse arrays.