with C++ Lecture 18
Introduction to Hash Tables
1. Definition and Structure
o A hash table (or hash map) is a data structure that associates
keys with values. It uses a hash function to compute an index
into an array of buckets or slots, from which the desired value
can be found.
2. Key Components
o Key: The identifier used to find the associated value.
o Value: The data associated with a key.
o Hash Function: Converts the key into an index for the array.
Example of a Hash Table
1. Storing Assignment Marks
o Using a student's name as a key and their mark as a value,
the name is hashed to determine the index position in the
table.
Example: