Probe Counts
Linear Probing Double Hashing Load Number of Probes Number of Probes Factor Hit Miss Hit Miss ------------------------------------------------ 1 1.01 1.01 1.01 1.01 2 1.01 1.02 1.01 1.02 3 1.02 1.03 1.02 1.03 4 1.02 1.04 1.02 1.04 5 1.03 1.05 1.03 1.05 6 1.03 1.07 1.03 1.06 7 1.04 1.08 1.04 1.08 8 1.04 1.09 1.04 1.09 9 1.05 1.10 1.05 1.10 10 1.06 1.12 1.05 1.11 11 1.06 1.13 1.06 1.12 12 1.07 1.15 1.07 1.14 13 1.07 1.16 1.07 1.15 14 1.08 1.18 1.08 1.16 15 1.09 1.19 1.08 1.18 16 1.10 1.21 1.09 1.19 17 1.10 1.23 1.10 1.20 18 1.11 1.24 1.10 1.22 19 1.12 1.26 1.11 1.23 20 1.13 1.28 1.12 1.25 21 1.13 1.30 1.12 1.27 22 1.14 1.32 1.13 1.28 23 1.15 1.34 1.14 1.30 24 1.16 1.37 1.14 1.32 25 1.17 1.39 1.15 1.33 26 1.18 1.41 1.16 1.35 27 1.18 1.44 1.17 1.37 28 1.19 1.46 1.17 1.39 29 1.20 1.49 1.18 1.41 30 1.21 1.52 1.19 1.43 31 1.22 1.55 1.20 1.45 32 1.24 1.58 1.21 1.47 33 1.25 1.61 1.21 1.49 34 1.26 1.65 1.22 1.52 35 1.27 1.68 1.23 1.54 36 1.28 1.72 1.24 1.56 37 1.29 1.76 1.25 1.59 38 1.31 1.80 1.26 1.61 39 1.32 1.84 1.27 1.64 40 1.33 1.89 1.28 1.67 41 1.35 1.94 1.29 1.69 42 1.36 1.99 1.30 1.72 43 1.38 2.04 1.31 1.75 44 1.39 2.09 1.32 1.79 45 1.41 2.15 1.33 1.82 46 1.43 2.21 1.34 1.85 47 1.44 2.28 1.35 1.89 48 1.46 2.35 1.36 1.92 49 1.48 2.42 1.37 1.96 50 1.50 2.50 1.39 2.00 51 1.52 2.58 1.40 2.04 52 1.54 2.67 1.41 2.08 53 1.56 2.76 1.42 2.13 54 1.59 2.86 1.44 2.17 55 1.61 2.97 1.45 2.22 56 1.64 3.08 1.47 2.27 57 1.66 3.20 1.48 2.33 58 1.69 3.33 1.50 2.38 59 1.72 3.47 1.51 2.44 60 1.75 3.62 1.53 2.50 61 1.78 3.79 1.54 2.56 62 1.82 3.96 1.56 2.63 63 1.85 4.15 1.58 2.70 64 1.89 4.36 1.60 2.78 65 1.93 4.58 1.62 2.86 66 1.97 4.83 1.63 2.94 67 2.02 5.09 1.65 3.03 68 2.06 5.38 1.68 3.13 69 2.11 5.70 1.70 3.23 70 2.17 6.06 1.72 3.33 71 2.22 6.45 1.74 3.45 72 2.29 6.88 1.77 3.57 73 2.35 7.36 1.79 3.70 74 2.42 7.90 1.82 3.85 75 2.50 8.50 1.85 4.00 76 2.58 9.18 1.88 4.17 77 2.67 9.95 1.91 4.35 78 2.77 10.83 1.94 4.55 79 2.88 11.84 1.98 4.76 80 3.00 13.00 2.01 5.00 81 3.13 14.35 2.05 5.26 82 3.28 15.93 2.09 5.56 83 3.44 17.80 2.13 5.88 84 3.62 20.03 2.18 6.25 85 3.83 22.72 2.23 6.67 86 4.07 26.01 2.29 7.14 87 4.35 30.09 2.35 7.69 88 4.67 35.22 2.41 8.33 89 5.05 41.82 2.48 9.09 90 5.50 50.50 2.56 10.00 91 6.06 62.23 2.65 11.11 92 6.75 78.63 2.75 12.50 93 7.64 102.54 2.86 14.29 94 8.83 139.39 2.99 16.67 95 10.50 200.50 3.15 20.00 96 13.00 313.00 3.35 25.00 97 17.17 556.06 3.62 33.33 98 25.50 1250.50 3.99 50.00 99 50.50 5000.50 4.65 100.00
Average probes for a hit (linear probing) ![]()
Average probes for a miss (linear probing) ![]()
Average probes for a hit (double-hashing) ![]()
Average probes for a miss (double-hashing) ![]()
A full, balanced binary search tree with 217 - 1 nodes (131,071):
Open-addressing slots Chaining nodes // Slots that will hold the key/data pairs struct OAHTSlot { char Key[MAX_KEYLEN]; // Key is a string T Data; // Client data enum OAHTSlot_State { OCCUPIED, UNOCCUPIED, DELETED }; OAHTSlot_State State; int probes; // For testing }; // Nodes that will hold the key/data pairs struct ChHTNode { char Key[MAX_KEYLEN]; // Key is a string T Data; // Client data ChHTNode *Next; ChHTNode(const T& data) : Data(data) {}; // constructor }; // Each list has a special head pointer struct ChHTHeadNode { ChHTNode *Nodes; ChHTHeadNode(void) : Nodes(0), Count(0) {}; int Count; // For testing };
sizeof(ChHTNode) is 40 sizeof(ChHTHeadNode) is 8 sizeof(OAHTSlot) is 44
Nodes Percentage of data --------------------------------------------------------------------------------- Level 0 nodes: 1 0.000762939453125% Level 1 nodes: 2 0.001525878906250% Level 2 nodes: 4 0.003051757812500% Level 3 nodes: 8 0.006103515625000% Level 4 nodes: 16 0.012207031250000% Level 5 nodes: 32 0.024414062500000% Level 6 nodes: 64 0.048828125000000% Level 7 nodes: 128 0.097656250000000% Level 8 nodes: 256 0.195312500000000% Level 9 nodes: 512 0.390625000000000% Level 10 nodes: 1024 0.781250000000000% Level 11 nodes: 2048 1.562500000000000% Level 12 nodes: 4096 3.125000000000000% Level 13 nodes: 8192 6.250000000000000% Level 14 nodes: 16384 12.500000000000000% Level 15 nodes: 32768 25.000000000000000% Level 16 nodes: 65536 50.000000000000000% Total nodes: 131,071