random - Split an array into chaotic sub-arrays? -
there need split info array consisting of n rows , m columns s non-intersecting parts of (approximately) equal size.
realistically n*m not divisible s have work blocks of size floor(n*m) , ceil(n*m). @ moment to the lowest degree of concerns.
the essential required property every block structurally disconnected wholeness of info in sense neither big chunks of globally adjacent elements belong same block nor checker-board style splitting.
what suggest? should turn randomness or there neat structures suitable in situation?
i've found myself idly mulling on during snatched periods of downtime, , seems there should few ways it; depends on want achieve. here's i've been dreaming up, in case it's useful.
as understand this, you'd split n x m array i equal chunks, n , m unknown, , without adjacent elements sharing set.
firstly, four colour theorem tells can 4 sets; might worth seeing if there's existing algoritm working these out array. on other end of scale, can trivially n x m groups, assigning each element it's own singleton set.
how approach rather depends on you'd minimise - whether want smallest number of groups i, example. if wasn't issue, seek following:
looking @ n alone, if n even, split array sets of size n/2, create n/2 sets - 1 containing 1st element of each group, 1 containing 2nd etc. these contain non-consecutive elements. if n odd, create singleton set consisting of nth element, , proceed above remainder.
in 1 - dimensional case, give n/2 sets of size 2, potential set of size 1. work 2 dimensions well, dividing both n , m above.
as said, isn't reply looking for, hope might help promote farther investigation - replace odd / check 1 highest mutual factor or prime decomposition, example. might worth asking on math overflow.
i can write pseudocode (or python) how above might possible, if useful.
random arrays
No comments:
Post a Comment