java - When to use hash table? -


i have general question when should use hash table instead of avl trees. remembered lecturer saying if data size 210 or 220, avl tree acceptable, because using hash table generate hashing operations etc.

so wonder in practice, there general rule regarding data size tell when should choose hash table on avl trees? hash table first choice when dealing data size larger 220?

hash tables 'wasteful' memory wise backing table larger number of entries. trees don't have problem have problem lookups (and other operations) log(n) operation. yes correct small data sets tree may better - depending on how care memory efficiency.

there's no general rule data regarding data size - depends on specifics of implementations comparing , want optimize (memory or cpu). javadocs provide insight performance of implementations provided java:

http://docs.oracle.com/javase/7/docs/api/java/util/treemap.html http://docs.oracle.com/javase/7/docs/api/java/util/hashmap.html

beyond writing benchmarks , comparing different implementations give more insight.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -