473,486 Members | 2,493 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

stdext::hash_map

3 New Member
Dear comunity,

my hash map is having to many collision, so I thought to increase the size of the internal index map. How can I do this?
Just increasing the functional range of the hash function?

I am using a normal stdext::hash_map with long as key and the stdext::hash function of course with long as key.

Any ideas, or is the problem to generally described?

Cheers mates,
Sebastian
Feb 22 '07 #1
4 1962
Ganon11
3,652 Recognized Expert Specialist
About how many collisions are we talking about? The problem could be that the hash_map has a small range of keys to assign hash codes to, or it may be that you are using a bad hash function.
Feb 22 '07 #2
SebastianBr
3 New Member
Thanks for your answer!

About how many collisions are we talking about? The problem could be that the hash_map has a small range of keys to assign hash codes to, or it may be that you are using a bad hash function.
There are probably thousands of collisions. I am trying use tripel of short values as key...and therefore I convert the three short values to a long value. With n=300 there are n^3 = 27 Mio possible tripel, and probably 1 Mio is actually saved in the hash table. Since the running time is amazingly low I guess there are at least some thousand collisions.

As hash function I am using the stdext::hash template function, and I do not really know how large the range of the keys actually is.
I thought one of you might have used this hash_map and the hash function before and you know how to increase the range of the keys of the hash codes.
An alternative would be another hash_map / function where I could set the hash range by hand.

Sebastian
Feb 22 '07 #3
Ganon11
3,652 Recognized Expert Specialist
As hash function I am using the stdext::hash template function, and I do not really know how large the range of the keys actually is.
I thought one of you might have used this hash_map and the hash function before and you know how to increase the range of the keys of the hash codes.
An alternative would be another hash_map / function where I could set the hash range by hand.
I wish I had, but to be honest, all I know about Hash Tables/Maps was learned in Java, and that class has a way to enlarge the size of possible keys. I'm not sure how to do this in C++.
Feb 22 '07 #4
SebastianBr
3 New Member
I wish I had, but to be honest, all I know about Hash Tables/Maps was learned in Java, and that class has a way to enlarge the size of possible keys. I'm not sure how to do this in C++.
no problem. its a taff question. nobody could answer me so far :(

thanks anyway!

still...anyone else with experience???
Feb 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1493
by: Jacek Generowicz | last post by:
Within our family of projects, we are looking to provide a recommended practice guideline, concerning hashed containers, which would help developers using different compilers, to write portable...
2
3830
by: Mike Lischke | last post by:
Hi group, Does anybody of you know a template that unites a vector and a hash map? What I'm after is a hash map that can also be accessed by index. I know that an associative container is not...
9
4163
by: collection60 | last post by:
I've been developing some Unix based shell tools. They work fine on Linux and MacOSX. I want to compile them on Win32. But I can't get hash_map to compile. I tried downloading stl (and...
4
8059
by: Dymus | last post by:
problem with deleting big sized hash_map. have defined a comporator, where defined min_bucket_size (for speed improvement, since i know that i need to store big ammount of data (~1Mln)),...
6
6142
by: SimpleCode | last post by:
class COsgCar; class moving_vechicle; hash_map<moving_vechicle*, COsgCar*m_hash; hash_map<moving_vechicle*, COsgCar*>::iterator iter; iter = m_hash.find( pMovingVechicle ); if ( iter !=...
2
1849
by: eagerlearner | last post by:
Can anyone check this out, why does this give me the default value of 0 instead of 1 ? Thank you. #include <iostream> #include <hash_map> #include <string> using namespace std; int main() {...
1
1777
by: Axel Gallus | last post by:
Hello, i have a question concerning STL non-standard hash_maps under Visual Studio 2005: Microsoft STL requires a "hash_compare" object for hash_maps: template <class Key, class Type, class...
1
475
by: Mirco Wahab | last post by:
Alf P. Steinbach wrote: No, there isn't any (afaik). You can look it up here: http://www.boost.org/doc/libs/1_35_0/doc/html/boost_tr1/unsupported.html#boost_tr1.unsupported.unordered_map ...
2
8103
by: marek.vondrak | last post by:
Hi, I am wondering if there are any functional differences between SGI's hash_map and tr1's unordered_map. Can these two containers be interchanged? What would it take to switch from hash_map to...
0
7105
marktang
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,...
0
6967
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...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.