0

Suppose you have a hash table where keys are strings and values are integers. Do you have any idea to visualize the hash table as a bar graph or histogram such that x-axis represents the key strings and y-axis represents the range of values? Thanks in advance!

4

1 回答 1

0

I don't know exactly what you are looking for but this is something you could do. You can use python with matplotlib. The following piece of code might help you to achieve what you want.

import matplotlib.pyplot as plt

hashtable = {'key1':10 , 'key2':20 , 'key3':14}
plt.bar(range(len(hashtable)), hashtable.values(), align='center')
plt.xticks(range(len(hashtable)), hashtable.keys())
plt.show()

For that you need to install python and matplotlib.

于 2013-07-12T18:02:13.833 回答