Program in C++
Task: Develop a program that reads integers N, M (1 < N, M < 256) from the keyboard, N pairs (key - integer, real number, or string depending on the task variant; value - string; all strings up to 255 characters), none of which are repeated, and M more keys. All strings are separated by a space or a new line. The program stores pairs of strings in a hash table and outputs the values corresponding to the listed keys on the screen. It is mandatory to implement one of the collision resolution methods. Task variant - key is a string; Pearson hashing.
Example input for string keys:
3 2
abc x
gh yq
io qw
gh
io
Output:
yq
qw
Using ready-made data structure implementations (e.g., STL) is prohibited, but you can use string implementation (e.g., std::string in C++).
Example input for string keys:
3 2
abc x
gh yq
io qw
gh
io
Output:
yq
qw
Using ready-made data structure implementations (e.g., STL) is prohibited, but you can use string implementation (e.g., std::string in C++).