Friday, May 21, 2010

In C++, we say vector is a matrix with one row or one column. How can a 2D array be called as a vector?

Actually, in C++, a vector refers to that managed array like datatype. The concept of a row or column isn't intrinsic. It's something your logic has to encode.





I'm not sure where this whole one-d array vs. 2d-array idea is coming from. Perhaps you can explain your thought process a bit further.

In C++, we say vector is a matrix with one row or one column. How can a 2D array be called as a vector?
A vector can be one, two, three, or more dimensions. You are thinking inside the box...
Reply:the "vector" concept came from physics..





a vector has 2 components to indicate its value..


the x-component and the y-component (it has 2 components).





and that is where the similarity starts and ends..


actually vector in physics is so much different with


the 2D array...


No comments:

Post a Comment