문제

There are some algorithms which need "infinite Data-Structures" like an infinite two-dimensional grid of cells. How is such a problem tackeld? Are they maybe using "pseudo-infinite" structures where just a large amount of data is used? Or is there somehow a "resize" implemented, when capacity is not enough?

I am using a Cellular-Automata Algorithm, which is beeing computed on a 2000 x 2000 grid, but i would like to have the grid infinitely.

도움이 되었습니까?

해결책

By using lazy evaluation.

Delaying the calculation (or creation) of each item in an infinite data structure until it is needed eliminates the problem of having to create an infinite data set.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top