473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stdext::hash_ma p

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_ma p 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 1970
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
1498
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 code. We are primarily interested in gcc 3.2 MSVC++ 6/7.0/7.1 (?) icc gcc 2.95
2
3836
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 laid out like a vector but I could imagine something like double references. That is, first a normal hash map and second a vector for indexed access...
9
4169
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 stlport) which is supposed to work in MSVC, but it doesn't, it just generates tons of errors for stuff that used to work just fine. Where do I get fts.h...
4
8062
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)), everything seems to be good, working fast, but problems start when try to .clear() or delete that hash_map... I think that it just take ennormous amount of...
6
6146
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 != m_hash.end() ) {
2
1850
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() { stdext::hash_map<const char *, int> hm;
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 Traits=hash_compare<Key, less<Key, class Allocator=allocator<pair <const Key, Type > class hash_map
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 Thanks & regards M.
2
8117
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 unordered_map? Thank you. -Marek
0
7541
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7979
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7497
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6065
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3512
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1960
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1074
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.