Ron Penton Data Structures book

Started by
7 comments, last by garbled 19 years, 3 months ago
Can someone explain why Penton treats a 2D array such as: a[4][3] like I would treat a[3][4]. At first I thought it was a mistake (page 115) but he does this multiple times throughout the chapter (page 124).
Advertisement
could you be a little more clearer?
maybe with some pseudocode or something?
cuz obviously you and him treat rows and columns differently.

Beginner in Game Development?  Read here. And read here.

 

Sorry!

He shows this after "a[4][3] = 10" :



Shouldn't this be a[3][4]? He is writing his own 2DArray class so perhaps this is how his implementation works but I just don't see it. If someone with the book could explain what he is doing here I would appreciate it.

And on page 124 he draws a 4x5 array with 5 rows and 4 columns. Just backwards to how I'm used to thinking about it.
I LOST MY DENTAL FLOSS!
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
//Edit: nm, I'm talking bs

[Edited by - Luctus on January 16, 2005 2:38:12 AM]
-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams
HughG: it doesn't matter which order you take, as long as you are consistent with your choice. A two dimensional array is just that: an abstract field of 2D data. The attribution of rows and columns to indices is purely arbitrary, there is no fixed notation of "this is X, and this is Y". A[x][y] is just as valid as a[y][x], as long as you don't mix both. It's a matter of preference.

It starts to matter when treating the 2D array as a matrix (the swapping of the index axes is called 'transposing' there), but in the simple case of a two dimensional grid, just use whatever notation you prefer and stick with it.
To add to the subject, I agree with Yann, it is all in how you use the array that matters...

Quote:Original post by Luctus
... In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move ...

ROFLMFAO!!!!! This is the funniest quote I have ever heard! Has replaced my favorite from Einstein... "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
Thanks,Tom Sapphttp://www.sappsworld.com
Quote:Original post by Raisor
Quote:Original post by Luctus
... In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move ...

ROFLMFAO!!!!! This is the funniest quote I have ever heard! Has replaced my favorite from Einstein... "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."


Yeah, I agree with you there. I told it to my friend one time and he was just like "...okay", I thought it was hilareous but no one else seemed to really get anything out of it.
It has to be a misprint. Your right about the picture, it should correspond to
a[3][4] = 10;
Because the first subscript is the number of arrays, which is the same as saying the amount of rows.

This topic is closed to new replies.

Advertisement