SE250:lab-5:sdal039

From Marks Wiki
Jump to navigation Jump to search

Sample Size: 10,000

Number of Keys: 100

Table Size: 1000

Sample size of 10,000 was chosen because it seemed to be the lowest order of magnitude that gave fairly similar results to any order of magnitude above, and different to orders of magnitude below. This would result in the fastest execution time for the level of accuracy we want.

Part 1

Low Entropy Source

<html>

FunctionEntropyChi sqMeanMonte CarloSeries Correlation
Buzhash7.9855099.00%125.8251.26%-0.000047
Buzhashn7.9821450.00%127.5892.10%0.000600
Hash CRC4.852470.01%99.26126.10%-0.285059
Java Integer Hash4.116060.01%32.38527.32%-0.217081
Java Object Hash2.000000.01%77.00027.32%-0.521556
Java String Hash7.9934799.99%127.3430.19%0.017074
Base 2560.000000.01%97.00027.32%undefined
Random7.935330.01%112.05410.82%-0.066125
High Random7.9846397.50%128.0350.04%0.011571

</html>


Typical Entropy Source

<html>

FunctionEntropyChi sqMeanMonte CarloSeries Correlation
Buzhash7.9797025.00%127.1771.95%-0.007153
Buzhashn7.9821450.00%127.5892.10%0.000600
Hash CRC7.778800.01%123.0871.11%-0.002250
Java Integer Hash4.116060.01%32.38527.32%-0.217081
Java Object Hash4.931570.01%116.58225.87%-0.506511
Java String Hash7.893010.01%126.0091.42%-0.021360
Base 2563.903090.01%107.98727.32%0.079032
Random7.935330.01%112.05410.82%-0.066125
High Random7.9846397.50%128.0350.04%0.011571

</html>


Best Hash Function

For low entropy source

1. Java String Hash

2. Buzhash

3. High Random

4. Buzhashn

5. Random

6. Hash CRC

7. Base 256

8. Java Object Hash

9. Java Integer Hash


For typical entropy source

1. Buzhashn

2. High Random

3. Buzhash

4. Random

5. Java String Hash

6. Hash CRC

7. Java Object Hash

8. Java Integer Hash

9. Base 256


Best in both cases: buzhashn and buzhash

Part 2

Low Entropy Source

<html>

Functionllpsexpected
Buzhash22.13803
Hash CRC22.13803
Base 2561002.13803
Java String Hash12.13803
Java Object Hash1002.13803

</html>


Typical Entropy Source

<html>

Functionllpsexpected
Buzhash12.13803
Hash CRC32.13803
Base 25642.13803
Java String Hash22.13803
Java Object Hash32.13803

</html>


In actual use, buzhash produced a hash table with the lowest linked-list length. For low entropy source base 256 and Java object hash both performed very badly, putting every cell into the same place in the array. While better in the typical entropy source, they still performed the worst out of the hash functions.