I have 82,160 3 number combinations (non repeating, like one set of 1,2,3 ;
not like 1,2,2) that I'd like create hash keys for with out collision, if
possible. I tried SuperFastHash and when I tried loading them to my database
I got some primary key failures which would indicate matching keys.
I'd like to apply any solution to 4 & 5 number combinations as well.
I'm open any ideas or thoughts.
Thanks
Best Regards. 9 2140
* Whybother: I have 82,160 3 number combinations (non repeating, like one set of 1,2,3 ; not like 1,2,2) that I'd like create hash keys for with out collision, if possible. I tried SuperFastHash and when I tried loading them to my database I got some primary key failures which would indicate matching keys.
I'd like to apply any solution to 4 & 5 number combinations as well. I'm open any ideas or thoughts.
What is the C++ question?
In other words, please post this q to e.g.[comp.programming].
It's off-topic here.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Whybother wrote: I have 82,160 3 number combinations (non repeating, like one set of 1,2,3 ; not like 1,2,2) that I'd like create hash keys for with out collision, if possible. I tried SuperFastHash and when I tried loading them to my database I got some primary key failures which would indicate matching keys.
I'd like to apply any solution to 4 & 5 number combinations as well. I'm open any ideas or thoughts.
How big are the number and how big is the required hash?
--
Ian Collins.
"Ian Collins" <ia******@hotmail.com> wrote in message
news:11***************@drone2-svc-skyt.qsi.net.nz... Whybother wrote: I have 82,160 3 number combinations (non repeating, like one set of 1,2,3 ; not like 1,2,2) that I'd like create hash keys for with out collision, if possible. I tried SuperFastHash and when I tried loading them to my database I got some primary key failures which would indicate matching keys.
I'd like to apply any solution to 4 & 5 number combinations as well. I'm open any ideas or thoughts. How big are the number and how big is the required hash?
-- Ian Collins.
the numbers run from 1-80 and the requirement is that each has is unique
Whybother wrote: "Ian Collins" <ia******@hotmail.com> wrote in message news:11***************@drone2-svc-skyt.qsi.net.nz... Whybother wrote: I have 82,160 3 number combinations (non repeating, like one set of 1,2,3 ; not like 1,2,2) that I'd like create hash keys for with out collision, if possible. I tried SuperFastHash and when I tried loading them to my database I got some primary key failures which would indicate matching keys.
I'd like to apply any solution to 4 & 5 number combinations as well. I'm open any ideas or thoughts. How big are the number and how big is the required hash?
the numbers run from 1-80 and the requirement is that each has is unique
It's only 80^3 combinations = 512000. An array of 512000 elements would
do the trick.
"Maxim Yegorushkin" <ma***************@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Whybother wrote: "Ian Collins" <ia******@hotmail.com> wrote in message news:11***************@drone2-svc-skyt.qsi.net.nz... > Whybother wrote: >> I have 82,160 3 number combinations (non repeating, like one set of >> 1,2,3 >> ; not like 1,2,2) that I'd like create hash keys for with out >> collision, >> if possible. I tried SuperFastHash and when I tried loading them to my >> database I got some primary key failures which would indicate matching >> keys. >> >> I'd like to apply any solution to 4 & 5 number combinations as well. >> I'm open any ideas or thoughts. >> > How big are the number and how big is the required hash?
the numbers run from 1-80 and the requirement is that each has is unique
It's only 80^3 combinations = 512000. An array of 512000 elements would do the trick.
Thats 80 to the third power, I'm talking about combinations, 80 choose 3 or
in excel combin(80,3). is 82,160. Thats not much and looking that up in a
database is quick too but when I get to 80 choose 5 , now we're talking
about 24 million and takes a little while to query the database thus the
plan to try to hash them so that its a matter of a quick look up of the hash
number.
thanks though.
Whybother wrote:
[] It's only 80^3 combinations = 512000. An array of 512000 elements would do the trick.
Thats 80 to the third power, I'm talking about combinations, 80 choose 3 or in excel combin(80,3). is 82,160. Thats not much and looking that up in a database is quick too but when I get to 80 choose 5 , now we're talking about 24 million and takes a little while to query the database thus the plan to try to hash them so that its a matter of a quick look up of the hash number.
There is no way to create a hash with N buckets for [0, M) element
range, N < M, without collisions, unless you know all elements in
advance, and even then that may not be possible.
Maxim Yegorushkin wrote: Whybother wrote:
[]
It's only 80^3 combinations = 512000. An array of 512000 elements would do the trick.
Thats 80 to the third power, I'm talking about combinations, 80 choose 3 or in excel combin(80,3). is 82,160. Thats not much and looking that up in a database is quick too but when I get to 80 choose 5 , now we're talking about 24 million and takes a little while to query the database thus the plan to try to hash them so that its a matter of a quick look up of the hash number.
There is no way to create a hash with N buckets for [0, M) element range, N < M, without collisions, unless you know all elements in advance, and even then that may not be possible.
He knows all elements in advance, and furthermore, in his case he
probably
wants N==M.
If I read it correctly, he wants to hash a key {C1,C2,C3} where
0<=C1<C2<C3<80. That's not really a C++ question, though. At least,
there is no standard C++ library function for that.
I'd hash {C1,C2,C3} as (C1*choose(80-C1,2) + hash {C2,C3})
HTH,
Michiel Salters
<Mi*************@tomtom.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com... Maxim Yegorushkin wrote: Whybother wrote:
[]
> > It's only 80^3 combinations = 512000. An array of 512000 elements > > would > > do the trick. > > > > Thats 80 to the third power, I'm talking about combinations, 80 choose > 3 or > in excel combin(80,3). is 82,160. Thats not much and looking that up in > a > database is quick too but when I get to 80 choose 5 , now we're talking > about 24 million and takes a little while to query the database thus > the > plan to try to hash them so that its a matter of a quick look up of the > hash > number.
There is no way to create a hash with N buckets for [0, M) element range, N < M, without collisions, unless you know all elements in advance, and even then that may not be possible.
He knows all elements in advance, and furthermore, in his case he probably wants N==M.
If I read it correctly, he wants to hash a key {C1,C2,C3} where 0<=C1<C2<C3<80. That's not really a C++ question, though. At least, there is no standard C++ library function for that.
I'd hash {C1,C2,C3} as (C1*choose(80-C1,2) + hash {C2,C3})
HTH, Michiel Salters
Yes that's exactly what I meant. And yes slightly off topic but c++ is my
native language and I generally find all the smart guys hang out in here. No
offense vb guys.
Thanks I will attempt that hash and if I read it correctly if c1,c2,c3 =
{1,2,3} then it'd be
(1* choose(80-1,2) + hash{ 2,3})
and hash would be passing 2,3 to my SuperFashHash function?
Thanks alot !!! Mi*************@tomtom.com wrote: He knows all elements in advance, and furthermore, in his case he probably wants N==M.
In this case, it's off topic here. But to give some useful hint, this is
called "perfect hash" and there exist some tools, e.g. "gperf", to
create them (gperf generates C-code which hashes strings)
Christian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Murali |
last post by:
I have a requirement where I have to use two unsigned ints as a key in a STL
hash map.
A couple of ways to do this is
1. create a struct with two unsigned ints and use that as key (write my own...
|
by: Bryan Olson |
last post by:
The current Python standard library provides two cryptographic
hash functions: MD5 and SHA-1 . The authors of MD5 originally
stated:
It is conjectured that it is computationally infeasible to...
|
by: kdotsky |
last post by:
Hello,
I am using some very large dictionaries with keys that are long strings
(urls). For a large dictionary these keys start to take up a
significant amount of memory. I do not need access to...
|
by: Arash Partow |
last post by:
Hi all,
I've ported various hash functions to python if anyone is interested:
def RSHash(key):
a = 378551
b = 63689
hash = 0
|
by: Johan Tibell |
last post by:
I would be grateful if someone had a minute or two to review my hash
table implementation. It's not yet commented but hopefully it's short
and idiomatic enough to be readable. Some of the code...
|
by: Hallvard B Furuseth |
last post by:
Is the code below valid? Generally a value must be accessed
through the same type it was stored as, but there is an exception
for data stored through a character type. I'm not sure if that...
|
by: ravi |
last post by:
Hi
can anybody tell me that which ds will be best suited to implement a
hash table in C/C++
thanx. in advanced
|
by: beginner |
last post by:
Hi All.
I'd like to do the following in more succint code:
if k in b:
a=b
else:
a={}
b=a
|
by: Jeff |
last post by:
Lets say we have what I would call a "hash":
var HASH =new Array();
HASH='first';
HASH='second';
HASH='third';
I'd like to return that as JSON data.
Is there a direct way to do that?
|
by: sixtyfootersdude |
last post by:
Good Morning!
I am a perl newbie and I think that I am struggling with references.
I have an array of references to hashes which I am trying to print. This is what I have:
for(my...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |