
- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup
- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming
- Data Structures
- DSA - Data Structure Basics
- DSA - Array Data Structure
- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue
- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table
- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort
- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal
- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Spanning Tree
- DSA - Heap
- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion
Double Hashing in Data Structure
In this section we will see what is Double Hashing technique in open addressing scheme. There is an ordinary hash function h´(x) : U → {0, 1, . . ., m – 1}. In open addressing scheme, the actual hash function h(x) is taking the ordinary hash function h’(x) when the space is not empty, then perform another hash function to get some space to insert.
$$h_{1}(x)=x\:mod\:m$$
$$h_{2}(x)=x\:mod\:m^{\prime}$$
$$h(x,i)=(h^{1}(x)+ih^{2})\:mod\:m$$
The value of i = 0, 1, . . ., m – 1. So we start from i = 0, and increase this until we get one free space. So initially when i = 0, then the h(x, i) is same as h´(x).
Example
Suppose we have a list of size 20 (m = 20). We want to put some elements in linear probing fashion. The elements are {96, 48, 63, 29, 87, 77, 48, 65, 69, 94, 61}
$$h_{1}(x)=x\:mod\:20$$
$$h_{2}(x)=x\:mod\:13$$
x h(x, i) = (h1 (x) + ih2(x)) mod 20
Hash Table
- Related Articles
- Universal Hashing in Data Structure
- Asymmetric Hashing in Data Structure
- LCFS Hashing in Data Structure
- Hashing by Division in Data Structure
- Hashing by Multiplication in Data Structure
- Hashing with Chaining in Data Structure
- Robin-Hood Hashing in Data Structure
- Hashing with Open Addressing in Data Structure
- C++ Program to Implement Hash Tables with Double Hashing
- Rectangle Data in Data Structure
- Deaps in Data Structure
- Quadtrees in Data Structure
- Halfedge data structure
- Boole’s Inequality in Data Structure
- Bayes’ Rule in Data Structure
