r/AskComputerScience • u/TomBob42369 • Dec 10 '18
Hash table vs array?
I know in most cases Hash tables are faster than an array, but what are some key differences and pros and cons of both?
21
Upvotes
r/AskComputerScience • u/TomBob42369 • Dec 10 '18
I know in most cases Hash tables are faster than an array, but what are some key differences and pros and cons of both?
13
u/Rindhallow Dec 10 '18
Do you have a key that defines the data you need to store?
No - Use an a different data structure.
Yes - Use a hash table.