Following is my scenario:
I am making use of a large 2D dynamic array to store elements with following attributes:
int
vector
Now, the array elements are accessed randomly. As a result, time access to elements greatly varies.
I want time access to elements to be small as well as constant for all the accessions.
Is dynamic array best suitable for my scenario?
I tries using unordered_map of boost but it seems that unordered map takes more time to access elements as compared to dynamic array.
Please give suggestions:
Code:
Code:
for( counter1=0; counter1< sizeof(chunk1); ++counter1)
{
//code lines skipped
IndexEntries &data=IndexTable[chunk1[counter1]][chunk1[counter1+1]];
DoubleTableEntries &GetValue=NewDoubleTable[NextState_chunk1][data.index];
NextState_chunk1= GetValue.Next_State;
++Bcount;
buffer[ Bcount]=NextState_chunk1;
++counter1;
// Code lines skipped
}
Here NewDoubleTable is the 2d Array from which I am accessing randomly elements.
int? Do you index the 2D array? Please give an example declaration and access.