- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Hash Tables for Integer Keys in Data Structure

Here we will discuss about the Hash tables with the integer keys. Here the key values 𝑥 comes from universe 𝑈 such that 𝑈 = {0, 1, … , 𝑢 – 2, 𝑢 – 1}. A hash function is ℎ. The domain of this hash function is 𝑈. The range is in the set {0, 1, … , 𝑚 – 1}, and 𝑚 ≤ 𝑢.

A hash function h is said to be a perfect hash function for a set 𝑆 ⊆ 𝑈 if for every 𝑥 ∈ 𝑆, ℎ(𝑥) is unique. A perfect hash function ℎ for 𝑆 is minimal if 𝑚 = |𝑆|. So ℎ is bijection between S and {0, 1, … , 𝑚 – 1}. Obviously a minimal perfect hash function is desirable since this allows us to store all the elements of S in a single array of length n.

Unfortunately, perfect hash functions are very rare, even if m is much larger than n. If each element in S is uniformly and independently mapped to a random element in {0, 1, … , 𝑚 – 1}, then according to birthday paradox if m is much less than n^{2} then there will almost surely exists two elements of S, that have the same hash value.

- Related Questions & Answers
- Hash Table Data Structure in Javascript
- Hash Functions and Hash Tables
- Get Hash Code for Integer in Java
- Joining two hash tables in Javascript
- C++ Program to Implement Hash Tables
- Extracting Keys and Values from Hash in Perl
- How to find keys of a hash in JavaScript?
- Tables for generated Time data in SAP HANA
- How to add/merge two hash tables in PowerShell?
- Rectangle Data in Data Structure
- C++ Program to Implement Hash Tables with Double Hashing
- C++ Program to Implement Hash Tables with Linear Probing
- C++ Program to Implement Hash Tables with Quadratic Probing
- What is Search Tree and Hash Tables in compiler design?
- Huffman Algorithm for t-ary Trees in Data Structure