{"id":52186,"date":"2025-06-19T15:16:25","date_gmt":"2025-06-19T09:46:25","guid":{"rendered":"https:\/\/www.iquanta.in\/blog\/?p=52186"},"modified":"2025-06-19T15:16:29","modified_gmt":"2025-06-19T09:46:29","slug":"hashing-in-data-structure-its-complexity-working","status":"publish","type":"post","link":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/","title":{"rendered":"Hashing in Data Structure: It&#8217;s Complexity &amp; Working"},"content":{"rendered":"\n<p>We all are using Google or Instagram in our day-to-day lives and both the applications can find the things quickly, and the answer to that logic comes under hashing in data structure. In the world of computer science we are dealing with lot of data everyday in the form of files, numbers, names and many more. <\/p>\n\n\n\n<p>And searching all data one by one is like a hell for findings that&#8217;s where the concept of hashing in data structure comes in picture. It&#8217;s like giving every piece of data a shortcut or unique address to search for. In this blog we will discuss about what is hashing data structure, how it works, types of hashing in data structure, collision resolution techniques, time and space complexity of hash data structure and so on.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_77 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#What_is_Hashing_in_Data_Structure\" >What is Hashing in Data Structure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#How_Hashing_Data_Structure_Works\" >How Hashing Data Structure Works?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Types_of_Hashing_in_Data_Structure\" >Types of Hashing in Data Structure<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Direct_Addressing\" >Direct Addressing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Chaining\" >Chaining<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Open_Addressing\" >Open Addressing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Perfect_Hashing\" >Perfect Hashing<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Collision_Resolution_Techniques\" >Collision Resolution Techniques<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Time_and_Space_Complexity_of_Hashing_Data_Structure\" >Time and Space Complexity of Hashing Data Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Advantages_of_Hashing_Data_Structure\" >Advantages of Hashing Data Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Disadvantages_of_Hashing_in_Data_Structure\" >Disadvantages of Hashing in Data Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Applications_of_Hashing_in_Data_Structure\" >Applications of Hashing in Data Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#What_is_the_purpose_of_performing_hashing_in_data_structure\" >What is the purpose of performing hashing in data structure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#What_is_a_collision_in_hashing_data_structure\" >What is a collision in hashing data structure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Which_is_the_best_collision_resolution_technique\" >Which is the best collision resolution technique?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Is_hashing_data_structure_used_in_AI_machine_learning\" >Is hashing data structure used in AI &amp; machine learning?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#Can_we_resize_a_hash_table\" >Can we resize a hash table?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-hashing-in-data-structure\"><span class=\"ez-toc-section\" id=\"What_is_Hashing_in_Data_Structure\"><\/span><strong>What is Hashing in Data Structure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Hashing in data structure is a technique which is used to store and find data quickly. Instead of checking every element one by one, hashing is using a special term called hash function to perform the respective tasks. This hash value tells the computer exactly where to store or look for your data in a hash table. <\/p>\n\n\n\n<p>Let&#8217;s explore a practical example to understand this concept properly. For that think a real world example where we are storing books in a library and instead of searching each selves one by one to be there in a library room, we have assigned respective numbers to the books under each locker so that finding books from the shelves becomes easy and flexible. So this example considered to be a proper example to understand the concept of learning in hashing data structure.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"989\" height=\"590\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144.png\" alt=\"hashing in data structure\" class=\"wp-image-52210\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144.png 989w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144-300x179.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144-768x458.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144-704x420.png 704w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144-150x89.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-144-696x415.png 696w\" sizes=\"(max-width: 989px) 100vw, 989px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-hashing-data-structure-works\"><span class=\"ez-toc-section\" id=\"How_Hashing_Data_Structure_Works\"><\/span><strong>How Hashing Data Structure Works?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this section we will look at the different steps to understand the working of hashing data structure in computer science. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Step<\/strong><\/td><td><strong>Action<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>Step 1<\/td><td>Take the input key<\/td><td>Key = 27<\/td><\/tr><tr><td>Step 2<\/td><td>Apply the hash function<\/td><td>Hash = key % table_size = 27 % 10 = 7<\/td><\/tr><tr><td>Step 3<\/td><td>Use the result as an index in hash table<\/td><td>Store the value at index 7 in the hash table<\/td><\/tr><tr><td>Step 4<\/td><td>To search, apply the same hash function<\/td><td>Search Key = 27 \u2192 Hash = 27 % 10 = 7<\/td><\/tr><tr><td>Step 5<\/td><td>Access the index directly to get the value<\/td><td>Go to index 7 and retrieve the data<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To understand the above table we have taken input key is 27 and using the hash function to generalize the formula to fetch the entry from the hash table. In the second step we are basically applying the hash function where we generalize it with the formula Hash = key % table_size = 27 % 10 = 7. Post this we use the result as an index in hash table. <\/p>\n\n\n\n<p>If we want to search any element the we need to apply the same hash function and access the index directly to get the value. So these all are basic steps that we need to add for the hashing data structure to work properly.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113.png\" alt=\"hashing in data structure\" class=\"wp-image-51755\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-113-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-types-of-hashing-in-data-structure\"><span class=\"ez-toc-section\" id=\"Types_of_Hashing_in_Data_Structure\"><\/span><strong>Types of Hashing in Data Structure<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-direct-addressing\"><span class=\"ez-toc-section\" id=\"Direct_Addressing\"><\/span><strong>Direct Addressing<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In direct addressing, each key is used as an index to store data directly in an array. This method is very fast (O(1) time), but it only works well when the key values are small and not too far apart. It is not practical for large key ranges due to high memory usage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-chaining\"><span class=\"ez-toc-section\" id=\"Chaining\"><\/span><strong>Chaining <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Chaining handles collisions by storing multiple elements at the same index using a linked list (or any dynamic structure). When two keys hash to the same index, they are simply added to the list at that index. This keeps the hash table efficient even when collisions occur.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-open-addressing\"><span class=\"ez-toc-section\" id=\"Open_Addressing\"><\/span><strong>Open Addressing<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In open addressing, all elements are stored within the hash table itself. When a collision occurs, the algorithm searches for the next available slot using methods like linear probing or quadratic probing. This approach avoids linked lists but requires careful probing to avoid clustering.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-perfect-hashing\"><span class=\"ez-toc-section\" id=\"Perfect_Hashing\"><\/span><strong>Perfect Hashing<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Perfect hashing is used when the set of keys is fixed and known in advance. It creates a hash function that guarantees no collisions, making search operations always O(1). This method is ideal for static datasets like reserved keywords in compilers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-collision-resolution-techniques\"><span class=\"ez-toc-section\" id=\"Collision_Resolution_Techniques\"><\/span><strong>Collision Resolution Techniques<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Type<\/strong><\/td><td><strong>How It Works?<\/strong><\/td><td><strong>When to Use<\/strong><\/td><\/tr><tr><td>Direct Addressing<\/td><td>Key = index directly<\/td><td>Small, fixed key ranges<\/td><\/tr><tr><td>Chaining<\/td><td>Linked list at each slot<\/td><td>Handles collisions easily<\/td><\/tr><tr><td>Open Addressing<\/td><td>Probe sequence within table<\/td><td>Compact tables, no extra lists<\/td><\/tr><tr><td>Perfect Hashing<\/td><td>Collision-free, static set<\/td><td>Fixed key sets\u2014no dynamic updates<\/td><\/tr><tr><td>Universal Hashing<\/td><td>Random hash function from a family<\/td><td>Adversarial or unpredictable keys<\/td><\/tr><tr><td>Division\/Folding\/Mid-square<\/td><td>Simple arithmetic or bit methods<\/td><td>Basic use cases, easy implementation<\/td><\/tr><tr><td>Extendible\/Linear<\/td><td>Dynamic, grows\/shrinks on demand<\/td><td>DBs &amp; filesystems with dynamic load<\/td><\/tr><tr><td>Consistent Hashing<\/td><td>Virtual ring, ideal for distributed systems<\/td><td>Data sharding &amp; distributed caches<\/td><\/tr><tr><td>2\u2011Choice Hashing<\/td><td>Two hash choices, choose the less full slot<\/td><td>High-performance in-memory tables<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-time-and-space-complexity-of-hashing-data-structure\"><span class=\"ez-toc-section\" id=\"Time_and_Space_Complexity_of_Hashing_Data_Structure\"><\/span><strong>Time and Space Complexity of Hashing Data Structure<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Operation<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Best Case<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Average Case<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Worst Case<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Search<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Insert<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Delete<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Space<\/td><td class=\"has-text-align-center\" data-align=\"center\">Nil<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n)<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-advantages-of-hashing-data-structure\"><span class=\"ez-toc-section\" id=\"Advantages_of_Hashing_Data_Structure\"><\/span><strong>Advantages of Hashing Data Structure <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol>\n<li>Fast data access using key based lookup (O(1) time on average).<\/li>\n\n\n\n<li>Efficient for large datasets with quick insert, delete, and search.<\/li>\n\n\n\n<li>Easy to implement with simple arithmetic functions.<\/li>\n\n\n\n<li>Ideal for applications like databases, caches, and dictionaries.<\/li>\n\n\n\n<li>Can handle dynamic and static data efficiently with proper methods.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142.png\" alt=\"\" class=\"wp-image-52207\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-142-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-disadvantages-of-hashing-in-data-structure\"><span class=\"ez-toc-section\" id=\"Disadvantages_of_Hashing_in_Data_Structure\"><\/span><strong>Disadvantages of Hashing in Data Structure<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol>\n<li>Collisions can reduce performance if not handled properly.<\/li>\n\n\n\n<li>Hashing does not maintain any order of data.<\/li>\n\n\n\n<li>Fixed-size hash tables can become inefficient if overloaded.<\/li>\n\n\n\n<li>Designing a good hash function can be tricky.<\/li>\n\n\n\n<li>Rehashing during resizing is time-consuming and costly.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-applications-of-hashing-in-data-structure\"><span class=\"ez-toc-section\" id=\"Applications_of_Hashing_in_Data_Structure\"><\/span><strong>Applications of Hashing in Data Structure<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol>\n<li>Used in implementing hash tables, maps, and dictionaries.<\/li>\n\n\n\n<li>Helps in quick data retrieval in database indexing.<\/li>\n\n\n\n<li>Used for storing and verifying passwords securely.<\/li>\n\n\n\n<li>Supports caching mechanisms in web browsers and servers.<\/li>\n\n\n\n<li>Plays a key role in compiler symbol tables and memory management.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Hashing in <a href=\"https:\/\/www.iquanta.in\/blog\/100-data-structures-interview-questions-topic-wise\/\">data structure<\/a> helps store and find data quickly and easily it avoids checking each item one by one by using a special function that sends the data directly to the right place this method saves a lot of time and works well for tasks like checking passwords searching in databases and storing user details<\/p>\n\n\n\n<p>A good hash function and proper handling of collisions make hashing more effective and reliable it performs well especially when the data is large and needs quick access many systems like search engines and online shopping platforms.<\/p>\n\n\n\n<p>You can use hashing to create faster programs and smarter solutions it is easy to learn and powerful for both new and experienced programmers who want to write better and more efficient code<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span><strong>Frequently Asked Questions<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-the-purpose-of-performing-hashing-in-data-structure\"><span class=\"ez-toc-section\" id=\"What_is_the_purpose_of_performing_hashing_in_data_structure\"><\/span><strong>What is the purpose of performing hashing in data structure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Hashing data structure is a very important concept in computer science and we would use this concept when we use to retrieve data faster and might it uses key that align with the table and converts keys into indexes using hash table.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-a-collision-in-hashing-data-structure\"><span class=\"ez-toc-section\" id=\"What_is_a_collision_in_hashing_data_structure\"><\/span><strong>What is a collision in hashing data structure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Collision is a condition that occurs when two keys are collide at the same index of the hash table. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-which-is-the-best-collision-resolution-technique\"><span class=\"ez-toc-section\" id=\"Which_is_the_best_collision_resolution_technique\"><\/span><strong>Which is the best collision resolution technique?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>There is no one size that fits all but most probably chaining is easier to implement whereas open addressing collision technique requires more memory as it is less memory efficient. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143.png\" alt=\"\" class=\"wp-image-52208\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/image-143-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-is-hashing-data-structure-used-in-ai-amp-machine-learning\"><span class=\"ez-toc-section\" id=\"Is_hashing_data_structure_used_in_AI_machine_learning\"><\/span><strong>Is hashing data structure used in AI &amp; machine learning?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Yes, hashing data structure is used in feature engineering and also in several concepts of AI &amp; Machine Learning.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-can-we-resize-a-hash-table\"><span class=\"ez-toc-section\" id=\"Can_we_resize_a_hash_table\"><\/span><strong>Can we resize a hash table?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Yes we can resize a hash table but it is very costly operation to perform.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all are using Google or Instagram in our day-to-day lives and both the applications can find the things quickly, and the answer to that logic comes under hashing in data structure. In the world of computer science we are dealing with lot of data everyday in the form of files, numbers, names and many [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":52194,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1075,1073],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.4 (Yoast SEO v21.9.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hashing in Data Structure: It&#039;s Complexity &amp; Working - iQuanta<\/title>\n<meta name=\"description\" content=\"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hashing in Data Structure: It&#039;s Complexity &amp; Working\" \/>\n<meta property=\"og:description\" content=\"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\" \/>\n<meta property=\"og:site_name\" content=\"iQuanta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/iquanta.in\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-19T09:46:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-19T09:46:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/Your-paragraph-text-49.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nidhi Goswami\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nidhi Goswami\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\"},\"author\":{\"name\":\"Nidhi Goswami\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\"},\"headline\":\"Hashing in Data Structure: It&#8217;s Complexity &amp; Working\",\"datePublished\":\"2025-06-19T09:46:25+00:00\",\"dateModified\":\"2025-06-19T09:46:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\"},\"wordCount\":1268,\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"articleSection\":[\"DSA and Competitive Programming\",\"iSkills\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\",\"name\":\"Hashing in Data Structure: It's Complexity &amp; Working - iQuanta\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\"},\"datePublished\":\"2025-06-19T09:46:25+00:00\",\"dateModified\":\"2025-06-19T09:46:29+00:00\",\"description\":\"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.iquanta.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hashing in Data Structure: It&#8217;s Complexity &amp; Working\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"name\":\"iQuanta | Cat Preparation Online\",\"description\":\"Building Learning Networks\",\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\",\"name\":\"IQuanta\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"contentUrl\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"width\":525,\"height\":200,\"caption\":\"IQuanta\"},\"image\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/iquanta.in\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\",\"name\":\"Nidhi Goswami\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"caption\":\"Nidhi Goswami\"},\"url\":\"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Hashing in Data Structure: It's Complexity &amp; Working - iQuanta","description":"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/","og_locale":"en_US","og_type":"article","og_title":"Hashing in Data Structure: It's Complexity &amp; Working","og_description":"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.","og_url":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/","og_site_name":"iQuanta","article_publisher":"https:\/\/facebook.com\/iquanta.in","article_published_time":"2025-06-19T09:46:25+00:00","article_modified_time":"2025-06-19T09:46:29+00:00","og_image":[{"width":1600,"height":900,"url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/06\/Your-paragraph-text-49.png","type":"image\/png"}],"author":"Nidhi Goswami","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nidhi Goswami","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#article","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/"},"author":{"name":"Nidhi Goswami","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3"},"headline":"Hashing in Data Structure: It&#8217;s Complexity &amp; Working","datePublished":"2025-06-19T09:46:25+00:00","dateModified":"2025-06-19T09:46:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/"},"wordCount":1268,"publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"articleSection":["DSA and Competitive Programming","iSkills"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/","url":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/","name":"Hashing in Data Structure: It's Complexity &amp; Working - iQuanta","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/#website"},"datePublished":"2025-06-19T09:46:25+00:00","dateModified":"2025-06-19T09:46:29+00:00","description":"Learn everything about hashing in data structure, including how it works, types of hashing, collision resolution techniques, time complexity.","breadcrumb":{"@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.iquanta.in\/blog\/hashing-in-data-structure-its-complexity-working\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.iquanta.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Hashing in Data Structure: It&#8217;s Complexity &amp; Working"}]},{"@type":"WebSite","@id":"https:\/\/www.iquanta.in\/blog\/#website","url":"https:\/\/www.iquanta.in\/blog\/","name":"iQuanta | Cat Preparation Online","description":"Building Learning Networks","publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.iquanta.in\/blog\/#organization","name":"IQuanta","url":"https:\/\/www.iquanta.in\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","contentUrl":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","width":525,"height":200,"caption":"IQuanta"},"image":{"@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/iquanta.in"]},{"@type":"Person","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3","name":"Nidhi Goswami","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","caption":"Nidhi Goswami"},"url":"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/"}]}},"_links":{"self":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52186"}],"collection":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/users\/560"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/comments?post=52186"}],"version-history":[{"count":6,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52186\/revisions"}],"predecessor-version":[{"id":52211,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/52186\/revisions\/52211"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media\/52194"}],"wp:attachment":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media?parent=52186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/categories?post=52186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/tags?post=52186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}