c++ - For storage of sparse matrices which is better a vector or a vector for each row different -


i using data structure storing sparse matrices follow. if having matrix follows enter image description here

i using vector of pairs store data. better store these value in single vector this:-

enter image description here

or better store them this:-

enter image description here

i using seperate vector store data starting , end indexes each row.

which of 2 methods use less memory?????

because vector allocates single block of contiguous memory (unlike list), single vector use less memory consolidating heap overhead. assume client interface same regardless (overloading operator[], example), question memory efficency.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -