A Hash Table is a data structure that stores key-value pairs using a hash function to map keys to array indices for fast access.
#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
unordered_map<string, int> marks;
marks["Alice"] = 90;
marks["Bob"] = 80;
cout << "Alice's marks: " << marks["Alice"] << endl;
// Check if key exists
if (marks.count("Bob"))
cout << "Bob is present." << endl;
return 0;
}
Readings Hash table
Videos Hash table