algorithm - Is possible to denote a vector of numbers uniquely as a number? -


given vector of numbers: v=(v1, v2, ..., vn). these n numbers don't need distinct or sorted.

suppose have few vectors v1, v2, ..., vm. possible use number (integer or float number) uniquely denote each vector, such vi not equal vj, corresponding numbers f(vi) , f(vj) not equal either.

a simple solution have 1 number in range 0 m-1 id represent vector, assume kind of solution cannot work in case each vector stored in few distributed machines. is, portions of vectors in 2 machines might overlap, , algorithm doesn't know distribution of vectors globally.

i'm assuming inputs in principle unbounded , output number, it's trivial otherwise. simple way concatenations representations of n , v1, v2, .. vn in base b. represent them in k-bit digits, annotate each k-bit digit continuation bit (0 if next k-bit group starts new number, 1 if belongs same number). isn't of use except equality tests, did not mention else.

if care preserving locality (i.e. nearby points p, q have nearby values f(p), f(q)), space-filling curves can used purpose. hilbert curve bit complicated generalize higher dimensions, , calculation nontrivial. z-order curve isn't @ preserving locality, it's trivial implement number of dimensions -- interleave bits of binary representation.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -