HashTable

NULL, SOLVED
Last edited on
Testing with this condition:

1
2
3
4
5
6
7
8
if ( memset( hashTable, hashIndex, sizeof( hashTable ) ) == NULL )
{	
                hashTable[hashIndex].m_name = s.m_name;
                hashTable[hashIndex].m_priceDate  = s.m_priceDate;
	hashTable[hashIndex].m_sharePrice = s.m_sharePrice;
	hashTable[hashIndex].m_symbol = s.m_symbol;
	return true;
}


Almost works, except it thinks null slots are not null lol.
std::map's operator [] will create the element if it does not exist (I'm assuming that's what you are using). Use .find() if you don't want it to create the element.
i cant use that std or stl stuff =(

I keep saying to myself.."If this slot in memory is NULL, add to it" haha.
Last edited on
The objects members are null when i enter the function, so like i said I can use them in the if condition I cant declare a new object type and then transfer its address over after I test. Memset has failed.

is their a way to mess around with my &int references in an inginious way? haha
ah. Sorry. I fixed it. But it arises a new problem:

When checking for collisions, to insert in a hashtable, is it best to insert at the next avaiblable slot or the previous? Linear Probing is what im up against now.
Last edited on
It doesn't matter, they both are basically the same (complexity wise anyway).
Topic archived. No new replies allowed.