All pastes #507972 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-05-24 20:28 UTC
rendered paste body
int table::adtHashFunction(const char *cpKey) {    unsigned int adtHashPosition = 0;    struct node *newnode;    newnode = new node;    for(int i = 0; i < strlen(cpKey); i++)    {        //add each letter of the clients key for the hash position        adtHashPosition = adtHashPosition + cpKey[i];    }       //mod hash position by 1009 to get a constrained number    adtHashPosition = adtHashPosition % hashsize;      if(!adtHashTable[adtHashPosition])     {        adtHashTable[adtHashPosition] = newnode;    }         else     {        temp = new node;        temp = current;        current = adtHashTable[adtHashPosition];        current->next = temp;    }}