HashMap- Universe of keys small

  • Thread starter Thread starter TobiasF
  • Start date Start date
  • Tags Tags
    Universe
Click For Summary
SUMMARY

The discussion centers on the limitations of using direct addressing for dynamic sets when the universe of keys is large. It establishes that storing a large number of keys, particularly beyond 10,000, can lead to significant memory usage and potential performance issues due to hash collisions. The conversation highlights the trade-off between in-memory storage and disk-based storage, emphasizing the need for efficient data structures like hash tables or databases when managing larger key sets. The importance of understanding the size of the key universe and its implications on memory management is clearly articulated.

PREREQUISITES
  • Understanding of direct addressing techniques in data structures
  • Familiarity with hash tables and their collision resolution strategies
  • Knowledge of memory management and performance implications in programming
  • Basic concepts of database storage strategies and in-memory databases
NEXT STEPS
  • Research the principles of direct addressing and its applications
  • Learn about hash collision resolution techniques in depth
  • Explore memory management strategies for large data sets
  • Investigate the differences between in-memory databases and traditional disk-based databases
USEFUL FOR

Software developers, data structure enthusiasts, and anyone involved in optimizing memory usage and performance in applications that require dynamic key management.

TobiasF
Messages
1
Reaction score
0

Homework Statement

[/B]
"Direct addressing is a simple technique that works well when the universe U of
keys is reasonably small. Suppose that an application needs a dynamic set in which
each element has a key drawn from a not too large universe U. We shall assume that no two elements have the same key.
To represent the dynamic set, we use an array, or direct-address table, denoted
by T =[0, ...m-1]. Why can't the size of the universe be very large?"

Homework Equations

The Attempt at a Solution


I am entertaining the possibility that storing a large set of keys might be heavy on memory. However, I am not quite convinced: If we know that we are going to need a lot of keys for an application, then storing a large array is going to be resource-draining anyway.
 
Physics news on Phys.org
What is large? are you storing 10, 100, 1000 or 10,000 keys in memory? how big is each key?

There are many database engines that store whole tables in memory for faster access and they are on the order of 10,000 rows or more limited only by available memory.

In general, I use the 10,000 value as a tipping point between in-memory and disk based storage or between using a simple structure like a hash table (or properties object in Java) and switching to a database strategy.

With respect to your key universe not being large, it may have something to do with hash collisions where two elements have the same hash key and so now you have to add additional logic to handle the collision ie use a list object to hold both elements.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 14 ·
Replies
14
Views
6K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K