There are integer tuples which index cells of a sparse multi-dimensional array (points inside n-parallelepiped), $n \le 32$.
The array itself is a BST with keys formed as $key = (...((a_0 * S_1 + a_1) * S_2 + a_3 ) * ... + a_{n-2}) * S_{n-1} + a_{n-1}$,
such keys preserve the order of tuples and can be compared in constant time,
but they occupy $log_2 \prod_{i=0}^{n-1}{S_i} $ bits per key (in my program there are already $512-2048$ bit keys).
Total number of keys can be estimated beforehand and the usual array density is $10^{-10} - 10^{-20}$ (fraction of array cells that are populated).
The tuples are not available beforehand but are added to the array from time to time, and they are never deleted.
I want to shrink size of the keys at the expense of comparison time.
I need a data structure (hashtable) that:
- Maps a tuple into an integer as a perfect hash fuction in $O(n + \log N)$ time, where $N$ is the number of already processed tuples. Addition of a new tuple doesn't change any already existing mappings as they are in use elsewhere.
- allows key comparison in $\lt O(\log N)$ time (ideally constant time)
EDIT
This question is not about a multidimensional array enhancement, it's about hashing large integer tuples while preserving their row-major order.