perfect-hash Questions

4

I have 4000 strings and I want to create a perfect hash table with these strings. The strings are known in advance, so my first idea was to use a series of if statements: if (name=="aaa") return...
Blob asked 29/12, 2014 at 18:36

5

I'm trying to implement a fast function dispatcher using compile time generated arrays to being able to use it at runtime in O(1). Some lines of code just to clarify: template<int i> void f...
Serval asked 14/11, 2018 at 10:19

2

Solved

I recently read this article Throw away the keys: Easy, Minimal Perfect Hashing about generating a minimal perfect hash table for a known set of keys. The article seems to assume that you need an ...
Treharne asked 24/4, 2019 at 7:3

1

Solved

I have a set of C++ functions. I want to map this functions in an hash table, something like: unordered_map<function<ReturnType (Args...)> , SomethingElse>, where SomethingElse is not r...
Freytag asked 18/4, 2016 at 4:28

2

Solved

I have 10^8 random integers in the range [0; 2^63-1]. There are no duplicates. The full list is known at compile-time, but it is just unique random numbers. These numbers never change. To store one...
Swagger asked 19/7, 2011 at 6:55

2

First, define two integers N and K, where N >= K, both known at compile time. For example: N = 8 and K = 3. Next, define a set of integers [0, N) (or [1, N] if that makes the answer simpler) an...
Leveloff asked 4/1, 2013 at 16:27

7

Solved

I'm attempting to hash the values 10, 100, 32, 45, 58, 126, 3, 29, 200, 400, 0 I need a function that will map them to an array that has a size of 13 without causing any collisions. I've spent ...
Mchugh asked 9/11, 2010 at 6:4

1

Solved

I have a list of memory addresses from 0xc0003000 to 0xc04a0144 there are many gaps and < 4096 entries in the list. It is known at compile time and I want to make a perfect hash for it. Howeve...
Foetus asked 26/7, 2012 at 20:6

9

I have an integer type, say long, whose values are between Long.MIN_VALUE = 0x80...0 (-2^63) and Long.MAX_VALUE = 0x7f...f (2^63 - 1). I want to hash it with ~50% collision to a positive integer of...
Paviour asked 11/7, 2012 at 5:59

3

Solved

I would like to know how I can convert a short ASCII string to a number (int, float, or numeric string). I saw a couple of posts here mentioned perfect hashes which seems like it might be what I ne...
Curie asked 10/11, 2011 at 22:45

4

Solved

I want to create a Hash Map (or another structure, if you have any suggestions) to store key value pairs. The keys will all be inserted at once at the same time as the map is created, but I don't k...
Snooty asked 15/10, 2011 at 2:35

3

Solved

I have a C-language app where I need to do table lookups. The entries are strings, All are known at the start of runtime. The table is initialized once, and then looked up many times. The table c...
Polygenesis asked 7/9, 2011 at 3:38

8

Consider a lookup function with the following signature, which needs to return an integer for a given string key: int GetValue(string key) { ... } Consider furthermore that the key-value mapping...
Barber asked 16/7, 2011 at 1:41

2

Solved

While reading the pigeonhole principle on Wikipedia, I come across - "collisions are inevitable in a hash table because the number of possible keys exceeds the number of indices in the array. No ha...
Eastward asked 17/11, 2010 at 11:38

8

Solved

I have a requirement to (very) quickly process strings of a limited range, tallying their values. The input file is of the form: January 7 March 22 September 87 March 36 and so forth. Because th...
Alkalimeter asked 6/8, 2010 at 7:45
1

© 2022 - 2024 — McMap. All rights reserved.