java - HashMap n-dimensional using a recursive function -
i don't know how make matrix n dimensional using hashmap. idea enter number indicates dimension of matrix , make recursive function creates n-dimensional hashmap.
for example, if want 5 dimensional matrix, have inside of 1 4 dimensions, inside 3 dimensions , etc..
map<list<integer>, valuetype>
you can fill lists used key of map n amount of numbers. each number in list specifies offset of dimension specified index of number in list. there not more say, can of course wrap around , defend "out of bounds" , such indefinite operations, determine.
Comments
Post a Comment