Hash Table

Mason mason.green at gmail.com
Wed Mar 21 13:11:29 PDT 2007


Ok, I think I may have found a solution.

I'm going to create my Hash Table using the Tango HashSet container. I'm sure I could have used another container, but since my primary interest is speed I'll go with the HashSet.

I'll initialize the Hast Table like so:

        alias HashSet!(int) objectSet;
	objectSet[GRID_SIZE] hashTable;

	for(int i = 0; i < GRID_SIZE; i++)
		hashTable[i] = new objectSet;

The hashTable[] array represents the entire Hash Table. Each individual bucket in the table is created with a HashSet container, and I'll use a Hash Function to determine which bucket I place my object index into.

Is this a sound method or foolish? My primary goal is speed; I need my Hash Table to be as efficient as possible.

Comments?

Thanks, 
Mason 


More information about the Digitalmars-d-learn mailing list