All pastes #507888 Raw Edit

weird llist

public cpp v1 · immutable
·published 2007-05-24 19:55 UTC
rendered paste body
struct node {  struct node *next;  char *data;};class table {  private:    struct node **adtHashTable;    unsigned int hashsize;  public:    table() { table(1009); };    table(unsigned int hashsize);    ~table() {};    adtHashFunction(const char *cpKey);}table::table(unsigned int hashsize) {  adtHashTable = malloc(hashsize * sizeof(node *));  int i;  for(i = 0; i < hashsize; i++) {    adtHashTable[i] = NULL;  }}table::adtHashFunction(const char *cpKey) {  unsigned int adtHashPosition = 0;  struct node *newnode;  // calculate your hash value of cpKey, total % hashsize  newnode = new node;  if(!adtHashTable[adtHashPosition]) {    adtHashTable[adtHashPosition] = newnode;  } else {    struct node *current = adtHashTable[adtHashPosition];    while(current->next) { current = current->next; }    current->next = newnode;  }}