Can anyone give me any insight on how to perform a lookup on a key/definition hashtable?

This is the method that I am trying to use to perform the lookup:

const Object & lookup( const HashedObj & key ) const
{
	return theLists[ hash( key ) ];
}

From what little I understand about this, I believe I have to perform a hash on the given key to get the key/definition pair? I've been trying several different things to get this to work with no luck. I am getting the following error on the above method:

Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

How are you resolving collision?

How are you resolving collision?

I don't think I am having any collision problems. I can insert key/definition pairs into my hash table, but I just don't know how to implement the lookup function.

Well each different key has its unique hash value, and you use some sort of hashing function to keep the hash value within bounds of the array. Then after you
get the hash value, you insert the value associated with the key inside the array.

So to retrive the object given the key, you get the hash value of the key. Then
you use the same hashing function that you used to keep the hash value within the
array. This gives you the index associated with the hash value. So now all you need
to do is return the value stored at that index.

The error you got, implies, that you probably mis typed something, or forgot
to define the type for an object. You need to show more code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.