10 if (( ctable = chashCreate(1000, 0.40)) == NULL) {
11 printf("chashCreate error\n"); //creates hashtable
14 for (i = 1; i <= 2000; i++) { // Checks the insert() and resize()
15 if (chashInsert(ctable, 10*i, &i) == 1)
16 printf("chashInsert error\n");
19 i = chashRemove(ctable, 10);//Delete first element in the hashtable
21 printf("chashRemove error ");
23 for (i = 1; i <= 2000; i++) { // Check if it can search for all keys in hash table
24 val = chashSearch(ctable, 10*i);
26 printf("chashSearch error - val = %d\n", val);
28 printf("chashSearch key = %d val = %x\n",10*i, val);
31 i = chashRemove(ctable, 30);
33 printf("chashRemove error\n ");
34 i = chashRemove(ctable, 40);
36 printf("chashRemove error\n ");
37 i = chashRemove(ctable, 80);
39 printf("chashRemove error\n ");
40 i = chashRemove(ctable, 100);
42 printf("chashRemove error\n ");
43 i = chashRemove(ctable, 90);
45 printf("chashRemove error\n ");
47 for (i = 1; i <= 2000; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash
48 val = chashSearch(ctable, 10*i);
50 printf("chashSearch error - val = %d\n", val);
52 printf("chashSearch key = %d val = %x\n",10*i, val);
55 printf("The total number of elements in table : %d\n", ctable->numelements);