|
-
Oct 7th, 2002, 04:29 PM
#1
Thread Starter
Hyperactive Member
converting n-array into 1D array
the following rule is to convert 2D array into 1D array
Code:
[i][j]=(array+(i*row-length+j))
what is the rule for converting nD array into 1D array
can someone help
-
Oct 7th, 2002, 05:57 PM
#2
transcendental analytic
array+å(k=1 to n)ikÕ(j=1 to k)dj
dj being the j'th dimension and ik the index for k'th dimension
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 8th, 2002, 05:34 AM
#3
Hyperactive Member
Here's the rule for 3D array
[x][y][z]=*(array+((x*maxy)+y)*maxz+z)=array[((x*maxy)+y)*maxz+z]
If you need to use 1D as >3D array, I think you should consider to re-design your data structure to use 1D array as it is.
-
Oct 8th, 2002, 08:21 AM
#4
I think your keyboard rendered it useless keda.
See this thread for my implementation of a n-dim array:
http://www.vbforums.com/showthread.p...t=STRANGEARRAY
Look for the posts by me.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|