From: Simon Schuster Date: 2007-10-24T08:56:33+09:00 Subject: Re: recursive array could you provide some code to exemplify this? On 10/22/07, Dido Sevilla wrote: > On 10/23/07, Simon Schuster wrote: > > also, I'm interested in what is going on "behind the scenes" here. is > > a[4][4][4][4][0] actually reaching in 4 levels deep? > > Well, what seems to have happened here is you created what amounts to > a cyclic graph using the array. Every time you get the 4th index of > a, you get back a itself. It's not exactly reaching in four levels > deep but more accurately referencing itself four times. It's as if you > created an array of pointers in C, and had some element in the array > be a pointer back to the array itself. > > There are many uses for data structures of this type, as formal > computer science is rife with graphs and the algorithms to deal with > them. For instance, you could use such a structure as the internal > representation of a state machine of some kind (finite automaton, > pushdown automaton, linear bounded automaton, or even a Turing > machine) , with each state being represented by an array, the inputs > being indexes into the array, and the values of the array the new > states the machine enters when a particular input is received. This is > the simplest example I could think up off the top of my head, but read > any decent book on algorithms and data structures and you'll find > hundreds more. > > -- > 普通じゃないのが当然なら答える私は何ができる? > 普通でも普通じゃなくて感じるまま感じることだけをするよ! > http://stormwyrm.blogspot.com >