From e36f61ff8f18b13779a3c7e7b8f0c20bb9a115a9 Mon Sep 17 00:00:00 2001 From: sameer Date: Mon, 15 May 2023 12:31:37 +0530 Subject: [PATCH] xviserra added hashing --- algorithms/CPlusPlus/Hashing/hashing.md | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 algorithms/CPlusPlus/Hashing/hashing.md diff --git a/algorithms/CPlusPlus/Hashing/hashing.md b/algorithms/CPlusPlus/Hashing/hashing.md new file mode 100644 index 00000000..23eb6289 --- /dev/null +++ b/algorithms/CPlusPlus/Hashing/hashing.md @@ -0,0 +1,27 @@ +# Hashing in C++ + +## Introduction + +Hashing is the process of converting any data into a fixed-size string of characters. It is used to index and retrieve items in a database because it is faster than searching through all the items in the database. + +## Steps + +1. Include the unordered_map header file. +2. Create an instance of the unordered_map. +3. Insert key-value pairs into the unordered_map. +4. Retrieve values from the unordered_map. + +## Examples + +```cpp +#include +#include + +int main() { + std::unordered_map myMap; + myMap["John"] = 25; + myMap["Jane"] = 30; + std::cout << "John is " << myMap["John"] << " years old." << std::endl; + return 0; +} +