Although they are covered in the text to some extent, I would like to elaborate on the hashed data structures. One of the reasons is their heavy usage in cryptography, including the algorithms that run on mobile devices.
Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find an item using the shorter hashed key than to find it using the original value. That's why it is used in many encryption algorithms
Each of the data structures we have studied so fararray-based structures, restricted structures (Stacks and Queues), and linked listshave strengths and weaknesses. All of these structures have high densities. Restricted structures are fast, but they do not support access in the key field mode.
The array-based and linked list structures do offer access in the key field mode, but are slow because they use a sequential search to locate a node. Hashing is an alternative search technique (more accurately, a set of techniques) for locating a node in the key field mode. Unlike the Sequential Search algorithm, hashing algorithms are fast. When you want speed, think hashing.
Data structures that use hashing access algorithms are in wide use because of their ability to rapidly locate a node. The corresponding data structures that use them, called hashed data structures, vary in speed. However, when properly implemented, all of them are faster than the structures we have studied thus far.
There is a downside to hashed structures. For some applications, their overhead can be very high. However, there are many applications where the overhead of even the fastest hashed structure approaches zero. With their promise of speed and the possibility of low overhead, hashed data structures should always be considered in the designs.
Hashing access algorithms are a collection of algorithms that share a common characteristic: a given key is used to compute an index or a location into a primary storage area. Since the primary storage area is a group of sequentially numbered storage cells, it is normally implemented as an array.
Sometimes the nodes themselves are stored in the primary storage area at the computed location, and sometimes paths to the nodes are stored there.
Create a program that simulates an online dictionary using HashMap. The program should allow the user to perform the following operations:
1. Add an entry to the dictionary in a form of a pair of a word and its description, e.g. "square", a rectangle with equal sides.
2. Remove an entry by word
3. Display the description for a specified word
4. Display all entries (words and descriptions)