Hashing in Data Structure
Last Updated :
08 Jul, 2025
Improve
Hashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access.
- Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key.
- The great thing about hashing is, we can achieve all three operations (search, insert and delete) in O(1) time on average.
- Hashing is mainly used to implement a set of distinct items (only keys) and dictionaries (key value pairs).

Basics
- Introduction
- Applications
- Separate Chaining for Collision Handling
- Open Addressing for Collision Handling
Easy Problems
- Check tor Subset
- Check for Disjoint
- Check for Equal
- Fizz Buzz
- Max distance between two occurrences
- Duplicate within K Distance
- Intersection of Two Arrays
- Union of Two Arrays
- Most Frequent Element
- 2 Sum - Find if there is any pair
- 2 Sum - Count Pairs
- Count Pairs with Given Diff
- Only repetitive element from 1 to n-1
- Missing of a Range
- Missing from Min to Max of Array
- Minimum Subsets with distinct
- Minimum Removals for No Common
- Maximum points on the same line
Medium Problems
- Check If Array Pair Sums Divisible by k
- Longest subarray with sum divisible by k
- 3 Sum - Count all triplets with given sum
- 3 Sum – Find All Triplets with Zero Sum
- Itinerary from a given list of tickets
- Longest Subarray with Majority Greater Than K
- Number of Employees Under every Employee
- Largest subarray with 0 sum
- Subarray with given sum
- Longest Consecutive subsequence
- Largest Fibonacci Subset
- Consecutive Subset Partitioning
- Distincts in every window of size k
- Insert, delete, search and getRandom
- Min insertions for a palindrome permutation
- Maximum possible difference of two subsets
- Sorting using trivial hash function
- Smallest subarray with k distinct numbers
- All pairs (a, b) in an array such that a % b = k
- Group words with same set of characters
- k-th distinct (or non-repeating) .
Hard Problems
- Represent Fraction as String
- 4 Sum – Count quadruplets
- 4 Sum – Find all Quadruplets
- 4 Sum - From four sorted arrays
- Clone a Binary Tree with Randoms
- Largest subarray with equal 0s and 1s
- Longest Common Sum Span
- Palindrome Substring Queries
- Range Queries for Frequencies
- Subarrays having distinct count
- Maximum array from two arrays
- Sum of all unique sub-array sums.
- Recaman’s sequence
- Longest strict bitonic subsequence
- Duplicate Subtrees
- Submatrix with corners as 1
Quick Links :
- ‘Practice Problems’ on Hashing
- Top Hashing Interview Questions
- ‘Quizzes’ on Hashing
- Learn Data Structure and Algorithms | DSA Tutorial
Introduction to Hashing
Visit Course

Introduction to Hashing
