multidimensional arrays

Started by
20 comments, last by evilclown 22 years, 1 month ago
I'm trying to find out what I need, but the site is kinda confusing. I thought I wanted to be able to delete entries from the middle of a container, but maybe that would cause problems later on. Because if I have 1 as the index for a surface, and if I remove surface 0, surface 1 would move down to surface 0, 2 down to 1 so it would use the wrong texture. Maybe I should use something like perl's associative arrays? ( $arrayname["key"] = value ). Or do you know of something else that would work better?

One other thing, what does constant and linear time mean?
quote:linear time insertion and removal of elements at the beginning or in the middle
If I can't remove elements in the middle, what does this mean?

Does an assosiative array seem like the right choice?


Edited by - evilclown on February 27, 2002 12:09:45 PM
Advertisement
actually, using a single vector can be faster than a pointer array.
however, the loop must not be done with multiplication in it.
   for(int x = 0; x < width; x++){  int offset = 0;  for(int y = 0; y < height; y++)   vector[offset+ y] = 5; // [x*height + y]  offset+=height; }  

This topic is closed to new replies.

Advertisement