In the labs in previous lessons, you have searched a data file containing ID and inventory information in a variety of ways. Of the search algorithms studied, the fastest search algorithm was O(log2N) for a binary tree or binary search of an ordered array. It is possible to improve on these algorithms, reducing the order of searching to O(1). The data structure used to accomplish this is called a hash table, and the O(1) search is referred to as hashing.
An example of hashing frequently occurs in schools, when students line up into 26 lines, each line representing the first letter of their last name. Another example occurs when one large group or list of student schedules is broken down into smaller groupings or lists, often by grade level, for easier distribution. This is what hash-coded data storage is about - breaking up and reorganizing one big list into many smaller lists.
The key topics for this lesson are:
- Hashing Schemes
- Dealing with Collisions
- Order of a Hash-Coded Data Search
- HashSet and HashMap
|