645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
|
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
|
-
+
-
+
-
+
-
+
|
}
/*
* Print out the histogram and a few other pieces of information.
*/
result = (char *)ckalloc((NUM_COUNTERS * 60) + 300);
sprintf(result, "%u entries in table, %u buckets\n",
snprintf(result, 60, "%u entries in table, %u buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i = 0; i < NUM_COUNTERS; i++) {
sprintf(p, "number of buckets with %u entries: %u\n",
snprintf(p, 60, "number of buckets with %u entries: %u\n",
i, count[i]);
p += strlen(p);
}
sprintf(p, "number of buckets with %u or more entries: %u\n",
snprintf(p, 60, "number of buckets with %u or more entries: %u\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
snprintf(p, 60, "average search distance for entry: %.1f", average);
return result;
}
/*
*----------------------------------------------------------------------
*
* AllocArrayEntry --
|