in DS
256 views
1 vote
1 vote

Sartaj Sahani Chapter 7 question 9

I seem to have stumbled upon something very basic, and I can't figure out why.

The question asks "How large can the ratio of two memory requirements get?" when a 2D Array is stored as a 2d array in c++ and when stored as a 1D array by row major mapping.

The solution is given here https://www.cise.ufl.edu/~sahni/dsaac/public/exer/c7/e9.htm

What i don't understand is how  (4mn + 4m) / (4mn) = 1 + 4/n.

Shouldn't it be 1 +1/n ?

Can anyone help me out here ?

Thanks.

in DS
256 views

Please log in or register to answer this question.