Better data structure for the following restrictions?

Here are some limitations for the data structure that I need. It seems that none of the common data structures (I mentioned those that I thought below) are consistent with these. Can someone suggest one that I might not have thought of?

  • I need to be able to search using unsigned integer keys.
  • Elements to be stored are user-defined structures.
  • These indexes will be meager, usually extremely. There are no regular arrays.
  • The frequency of each index will have an uneven distribution, with small indices much more often than large indices.
  • N will usually be small, probably no more than 5 or 10, but I do not want to rely on it too much, because sometimes it can be much more.
  • The constant term is of great importance. I need to search very quickly when N is small. I have already tried shared hash tables and, empirically, they are too slow, even when N = 1, which means there are no collisions , probably due to the amount of indirection. However, I would be open to suggestions about specialized hash tables that take advantage of the other limitations mentioned.
  • Insert time is not important if search time is fast. Even the insertion time of O (N) is good enough.
  • Space efficiency is not very important, although it is important not just to use regular arrays.
+5
10

N , + . , N .

O (N), , k * N . O (1) K. , O (N) N < K/k. K , N. , Big O N s, , .

void *lookup(int key_to_lookup)
{
  int n = 0;
  while (table_key[n] != key_to_lookup)
    n++;
  return table_data[n];
}

.

-, / , N . , .

: . , , .

+4

cpus :

  • .
  • ( / ).

, .

O (N), , . (, 16 , , 8 ), . , , .

, O (N), -, , , 16 - , .

, , , . , "" , , , .
, . , . , , .

, , , O (log (N)), . , , N, , , , O (N).

:

  • < 256 - ->, (, , , ), - .
  • trie- , . , .

kmkaplan. , . ...

+3

- , :

, , ( - , - , O (N)), .

, ( -), .

-, -, k * c_1% c_2, / - , , ( cpus capabilites ) .

.

+2

: , , , , . , -.

+1

, , , - . :

1) - . - .

2) , , :

-, :

5 ( 32- . 64-, .) - , , - (discard ) , , .

, - 64 . , 16, . 64- , , 4 .

+1

Judy Arrays:

- C, , . Judy null . Judy , , , ... Judy , , , -, B-, , , , , .

+1

-, - . O (1) O (logN). , , , .

0

, N . , , 32 , N, . , .

, , - ​​ . , , , - -, , , (, (N-1), N 2 ^ ), , 0. dcache, , , , , , . N = 1?

, : , . , 16 / , .

0

-. , .

, , , -

, -, , , , .

, , O (n ^ 2), , , , , , , .

0

. java.util.concurrent , .

0

All Articles