SlideShare a Scribd company logo
1 of 19
ANJUMAN COLLEGE
OF ENGINEERING AND
TECHNOLOGY,
SADAR, NAGPUR.
DATA STRUCTURE AND PROGRAM
DESIGN
2017-18
Computer science and
Engineering
Seminar on:
Hashing
Guided by: Prof. Farhina Sheikh
COMPILED BY:
oAafaqueahmad Khan
oAsad Fazlani
oDanish Sheikh
oHimanshu Wasnik
oIrfan Sheikh
oJafar Sheikh
oRafiuddin
oRohit Raut
oSahil khan
oSourabh Phulpagar
HAS
HING
CONTENTS
INTRODUCTION
HASHING
HASH FUNCTION
CHARACTERISTICS OF HASH
FUNCTION
HASH TABLE
STATIC HASHING
TYPES OF HASH FUNCTION
DIVISION METHOD
INTRODUCTION
HASHING
Hashing is the process of indexing and
retrieving element (data) in a data structure to
provide faster way of finding the element
using the hash key.
In hashing time required to search an element
doesn’t depend on the number of element.
Using hashing data structure, an element is
searched with constant time complexity.
Hashing provides very fast access to records
on certain search conditions.
HASH FUNCTION
A hash function is a function which
takes a piece of data (i.e. key) as input
and outputs an integer (i.e. hash value)
which maps the data to a particular
index in the hash table.
CHARACTERISTICS OF
HASH FUNCTION
 It should be easy and quick to
compute.
 It should ideally be mathematically
one-to-one the set of relevant key
values.
 The number of collision should be less
while placing the records in the hash
table.
 It should achieve even distribution of
the key values that actually occur across
HASH TABLE
Hash Table also known as Hash Map is a
data structure which uses hash function
to generate key corresponding to the
associated value.
It is a tables from which an item can be
searched in o(1) time using a hash
function to form address from the key
STATIC HASHING
Primary Area: # primary pages fixed, allocated
sequentially, never deallocated; (say M buckets).
•A simple hash function: h(K) = f(K) mod M
Overflow area: disjoint from the primary area. It
keeps buckets which hold records whose key
maps to full bucket.
•Adding the address of an overflow bucket to a
primary area bucket is called chaining.
Collision does not cause a problem as long as
there is still room in the mapped bucket.
Overflow occurs during insertion when a record is
hashed to the bucket that is already full.
EXAMPLE
Assume f(k) = k. Let M = 5. So, h(k) = k mod
5
Bucket factor = 3 records
0 35 60
1 6 46
2 12 57 62
3 33
4 44
17
PROBLEMS OF STATIC
HASHING
 The main problem with static hashing: the number
of buckets is fixed:
• Long overflow chains can develop and degrade
performance.
• On the other hand, if a file shrinks greatly, a lot of
bucket space will be wasted.
 There are some other hashing techniques that
allow dynamically growing and shrinking hash
index. These include:
• Linear hashing
• Extendible hashing
TYPES OF HASH
FUNCTION:
A. Division method
B. MID square method
C. Folding Method
DIVISION METHOD
In this method, we choose a number m (i.e.,
memory locations) larger than the number of n
(i.e. number of records) of keys which uniquely
determine records). The number of usually
chosen to be a prime number or a number
without small divisors since this frequently
minimizes the number of The hash function H is
defined by:
H(K)=K(mod m)
Here K (mod m) denotes the remainder when K
is divided by m. The second formula is used
For example, a company has 68 employees and
they have been assigned 4-digit employee
number. Assume L (memory addresses in the
table) of 100 two digit addresses: 00, 01, 02...99.
Applying the above hash function, say, for
employee numbers:
3205, 7148, 2345
Here, we choose a prime number m close to 99,
such as 97 then
H (3205) = 4
H (7148) = 67
H(2345) = 17
That is, dividing 3205 by 97 gives a
remainder of 4, dividing 7148 by 97 gives a
remainder of 67 and dividing 2345 by 97
gives a remainder of 17. In the other case
where the memory addresses begin with 01
rather than 00, we choose the hash function:
H(3205) = 4+1=5
H(7148) = 67+1=68
H(2345) = 17+1=18
Ques:- Given following list of element
{63, 92, 84, 33, 90, 69, 97, 91}
Use Division method of hashing to sort the
hashing.
Solution:-
 Formula :-
• h(k) = k mode m
Given,
 k= keys element.
• The keys element is:
63 92 84 33 90 69 97 91
 m= Total no of Buckets.
• Total no of Buckets is 8 because we have 8
Calculation:-
h(k) = 63 % 8
h(k) = 7
h(k) = 92 % 8
h(k) = 6
h(k) = 84 % 8
h(k) = 4
h(k) = 32 % 8
h(k) = 0
h(k) = 90 % 8
h(k) = 2
h(k) = 69 % 8
h(k) = 5
h(k) = 97 % 8
h(k) = 1
h(k) = 91 % 8
h(k) = 3
Sr.
No.
Key Element,
(k)
Hash
Function
h(k) = k mod
m
Buckets
1. 63 63 % 8 0 32
2. 92 92 % 8 1 97
3. 84 84 % 8 2 90
4. 32 32 % 8 3 91
5. 90 90 % 8 4 84
6. 69 69 % 8 5 69
7. 97 97 % 8 6 92
Tabular
representation :-

More Related Content

What's hot

Finding similar items in high dimensional spaces locality sensitive hashing
Finding similar items in high dimensional spaces  locality sensitive hashingFinding similar items in high dimensional spaces  locality sensitive hashing
Finding similar items in high dimensional spaces locality sensitive hashingDmitriy Selivanov
 
Properties of real numbers
Properties of real numbers Properties of real numbers
Properties of real numbers Edrin Jay Morta
 
KRNIC Update
KRNIC UpdateKRNIC Update
KRNIC UpdateAPNIC
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsSarvesh Rawat
 
Introduction to HMM
Introduction to HMMIntroduction to HMM
Introduction to HMMHyoseop Lee
 
Redis Project: Relational databases & Key-Value systems
Redis Project: Relational databases & Key-Value systemsRedis Project: Relational databases & Key-Value systems
Redis Project: Relational databases & Key-Value systemsStratos Gounidellis
 
mongoDB Project: Relational databases & Document-Oriented databases
mongoDB Project: Relational databases & Document-Oriented databasesmongoDB Project: Relational databases & Document-Oriented databases
mongoDB Project: Relational databases & Document-Oriented databasesStratos Gounidellis
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Hossain Md Shakhawat
 
Example of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional searchExample of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional searchAbhijeet Agarwal
 
[Question Paper] Advanced SQL (Old Course) [April / 2015]
[Question Paper] Advanced SQL (Old Course) [April / 2015][Question Paper] Advanced SQL (Old Course) [April / 2015]
[Question Paper] Advanced SQL (Old Course) [April / 2015]Mumbai B.Sc.IT Study
 
graph based cluster labeling using GHSOM
graph based cluster labeling using GHSOMgraph based cluster labeling using GHSOM
graph based cluster labeling using GHSOMMahmoud Alfarra
 
Chapter 3 classroom
Chapter 3 classroomChapter 3 classroom
Chapter 3 classroomwellingb
 
RABIN KARP ALGORITHM STRING MATCHING
RABIN KARP ALGORITHM STRING MATCHINGRABIN KARP ALGORITHM STRING MATCHING
RABIN KARP ALGORITHM STRING MATCHINGAbhishek Singh
 
Some New Classes of 3-Total Product Cordial Graphs
Some New Classes of 3-Total Product Cordial Graphs Some New Classes of 3-Total Product Cordial Graphs
Some New Classes of 3-Total Product Cordial Graphs ijcoa
 
Rabin Karp - String Matching Algorithm
Rabin Karp - String Matching AlgorithmRabin Karp - String Matching Algorithm
Rabin Karp - String Matching AlgorithmSyed Owais Ali Chishti
 

What's hot (17)

Finding similar items in high dimensional spaces locality sensitive hashing
Finding similar items in high dimensional spaces  locality sensitive hashingFinding similar items in high dimensional spaces  locality sensitive hashing
Finding similar items in high dimensional spaces locality sensitive hashing
 
Properties of real numbers
Properties of real numbers Properties of real numbers
Properties of real numbers
 
KRNIC Update
KRNIC UpdateKRNIC Update
KRNIC Update
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 
Q#8
Q#8Q#8
Q#8
 
Introduction to HMM
Introduction to HMMIntroduction to HMM
Introduction to HMM
 
Redis Project: Relational databases & Key-Value systems
Redis Project: Relational databases & Key-Value systemsRedis Project: Relational databases & Key-Value systems
Redis Project: Relational databases & Key-Value systems
 
chapter-8.ppt
chapter-8.pptchapter-8.ppt
chapter-8.ppt
 
mongoDB Project: Relational databases & Document-Oriented databases
mongoDB Project: Relational databases & Document-Oriented databasesmongoDB Project: Relational databases & Document-Oriented databases
mongoDB Project: Relational databases & Document-Oriented databases
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)
 
Example of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional searchExample of iterative deepening search & bidirectional search
Example of iterative deepening search & bidirectional search
 
[Question Paper] Advanced SQL (Old Course) [April / 2015]
[Question Paper] Advanced SQL (Old Course) [April / 2015][Question Paper] Advanced SQL (Old Course) [April / 2015]
[Question Paper] Advanced SQL (Old Course) [April / 2015]
 
graph based cluster labeling using GHSOM
graph based cluster labeling using GHSOMgraph based cluster labeling using GHSOM
graph based cluster labeling using GHSOM
 
Chapter 3 classroom
Chapter 3 classroomChapter 3 classroom
Chapter 3 classroom
 
RABIN KARP ALGORITHM STRING MATCHING
RABIN KARP ALGORITHM STRING MATCHINGRABIN KARP ALGORITHM STRING MATCHING
RABIN KARP ALGORITHM STRING MATCHING
 
Some New Classes of 3-Total Product Cordial Graphs
Some New Classes of 3-Total Product Cordial Graphs Some New Classes of 3-Total Product Cordial Graphs
Some New Classes of 3-Total Product Cordial Graphs
 
Rabin Karp - String Matching Algorithm
Rabin Karp - String Matching AlgorithmRabin Karp - String Matching Algorithm
Rabin Karp - String Matching Algorithm
 

Similar to Hashing

Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfJaithoonBibi
 
Hashing techniques, Hashing function,Collision detection techniques
Hashing techniques, Hashing function,Collision detection techniquesHashing techniques, Hashing function,Collision detection techniques
Hashing techniques, Hashing function,Collision detection techniquesssuserec8a711
 
358 33 powerpoint-slides_15-hashing-collision_chapter-15
358 33 powerpoint-slides_15-hashing-collision_chapter-15358 33 powerpoint-slides_15-hashing-collision_chapter-15
358 33 powerpoint-slides_15-hashing-collision_chapter-15sumitbardhan
 
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxBabaShaikh3
 
Hash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxHash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxmy6305874
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptxkratika64
 
A Novel Approach of Caching Direct Mapping using Cubic Approach
A Novel Approach of Caching Direct Mapping using Cubic ApproachA Novel Approach of Caching Direct Mapping using Cubic Approach
A Novel Approach of Caching Direct Mapping using Cubic ApproachKartik Asati
 
HASHING IS NOT YASH IT IS HASH.pptx
HASHING IS NOT YASH IT IS HASH.pptxHASHING IS NOT YASH IT IS HASH.pptx
HASHING IS NOT YASH IT IS HASH.pptxJITTAYASHWANTHREDDY
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxSLekshmiNair
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms HashingManishPrajapati78
 

Similar to Hashing (20)

Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdf
 
LECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdfLECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdf
 
Hashing
HashingHashing
Hashing
 
Hashing techniques, Hashing function,Collision detection techniques
Hashing techniques, Hashing function,Collision detection techniquesHashing techniques, Hashing function,Collision detection techniques
Hashing techniques, Hashing function,Collision detection techniques
 
Unit4 Part3.pptx
Unit4 Part3.pptxUnit4 Part3.pptx
Unit4 Part3.pptx
 
Hashing 1
Hashing 1Hashing 1
Hashing 1
 
Hashing
HashingHashing
Hashing
 
358 33 powerpoint-slides_15-hashing-collision_chapter-15
358 33 powerpoint-slides_15-hashing-collision_chapter-15358 33 powerpoint-slides_15-hashing-collision_chapter-15
358 33 powerpoint-slides_15-hashing-collision_chapter-15
 
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
 
Hash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxHash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptx
 
8. Hash table
8. Hash table8. Hash table
8. Hash table
 
Hash tables
Hash tablesHash tables
Hash tables
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptx
 
A Novel Approach of Caching Direct Mapping using Cubic Approach
A Novel Approach of Caching Direct Mapping using Cubic ApproachA Novel Approach of Caching Direct Mapping using Cubic Approach
A Novel Approach of Caching Direct Mapping using Cubic Approach
 
HASHING IS NOT YASH IT IS HASH.pptx
HASHING IS NOT YASH IT IS HASH.pptxHASHING IS NOT YASH IT IS HASH.pptx
HASHING IS NOT YASH IT IS HASH.pptx
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptx
 
Data Structures- Hashing
Data Structures- Hashing Data Structures- Hashing
Data Structures- Hashing
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms Hashing
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptx
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 

Hashing

  • 1. ANJUMAN COLLEGE OF ENGINEERING AND TECHNOLOGY, SADAR, NAGPUR. DATA STRUCTURE AND PROGRAM DESIGN 2017-18 Computer science and Engineering Seminar on: Hashing Guided by: Prof. Farhina Sheikh
  • 2. COMPILED BY: oAafaqueahmad Khan oAsad Fazlani oDanish Sheikh oHimanshu Wasnik oIrfan Sheikh oJafar Sheikh oRafiuddin oRohit Raut oSahil khan oSourabh Phulpagar
  • 4. CONTENTS INTRODUCTION HASHING HASH FUNCTION CHARACTERISTICS OF HASH FUNCTION HASH TABLE STATIC HASHING TYPES OF HASH FUNCTION DIVISION METHOD
  • 6. HASHING Hashing is the process of indexing and retrieving element (data) in a data structure to provide faster way of finding the element using the hash key. In hashing time required to search an element doesn’t depend on the number of element. Using hashing data structure, an element is searched with constant time complexity. Hashing provides very fast access to records on certain search conditions.
  • 7. HASH FUNCTION A hash function is a function which takes a piece of data (i.e. key) as input and outputs an integer (i.e. hash value) which maps the data to a particular index in the hash table.
  • 8. CHARACTERISTICS OF HASH FUNCTION  It should be easy and quick to compute.  It should ideally be mathematically one-to-one the set of relevant key values.  The number of collision should be less while placing the records in the hash table.  It should achieve even distribution of the key values that actually occur across
  • 9. HASH TABLE Hash Table also known as Hash Map is a data structure which uses hash function to generate key corresponding to the associated value. It is a tables from which an item can be searched in o(1) time using a hash function to form address from the key
  • 10. STATIC HASHING Primary Area: # primary pages fixed, allocated sequentially, never deallocated; (say M buckets). •A simple hash function: h(K) = f(K) mod M Overflow area: disjoint from the primary area. It keeps buckets which hold records whose key maps to full bucket. •Adding the address of an overflow bucket to a primary area bucket is called chaining. Collision does not cause a problem as long as there is still room in the mapped bucket. Overflow occurs during insertion when a record is hashed to the bucket that is already full.
  • 11. EXAMPLE Assume f(k) = k. Let M = 5. So, h(k) = k mod 5 Bucket factor = 3 records 0 35 60 1 6 46 2 12 57 62 3 33 4 44 17
  • 12. PROBLEMS OF STATIC HASHING  The main problem with static hashing: the number of buckets is fixed: • Long overflow chains can develop and degrade performance. • On the other hand, if a file shrinks greatly, a lot of bucket space will be wasted.  There are some other hashing techniques that allow dynamically growing and shrinking hash index. These include: • Linear hashing • Extendible hashing
  • 13. TYPES OF HASH FUNCTION: A. Division method B. MID square method C. Folding Method
  • 14. DIVISION METHOD In this method, we choose a number m (i.e., memory locations) larger than the number of n (i.e. number of records) of keys which uniquely determine records). The number of usually chosen to be a prime number or a number without small divisors since this frequently minimizes the number of The hash function H is defined by: H(K)=K(mod m) Here K (mod m) denotes the remainder when K is divided by m. The second formula is used
  • 15. For example, a company has 68 employees and they have been assigned 4-digit employee number. Assume L (memory addresses in the table) of 100 two digit addresses: 00, 01, 02...99. Applying the above hash function, say, for employee numbers: 3205, 7148, 2345 Here, we choose a prime number m close to 99, such as 97 then H (3205) = 4 H (7148) = 67 H(2345) = 17
  • 16. That is, dividing 3205 by 97 gives a remainder of 4, dividing 7148 by 97 gives a remainder of 67 and dividing 2345 by 97 gives a remainder of 17. In the other case where the memory addresses begin with 01 rather than 00, we choose the hash function: H(3205) = 4+1=5 H(7148) = 67+1=68 H(2345) = 17+1=18
  • 17. Ques:- Given following list of element {63, 92, 84, 33, 90, 69, 97, 91} Use Division method of hashing to sort the hashing. Solution:-  Formula :- • h(k) = k mode m Given,  k= keys element. • The keys element is: 63 92 84 33 90 69 97 91  m= Total no of Buckets. • Total no of Buckets is 8 because we have 8
  • 18. Calculation:- h(k) = 63 % 8 h(k) = 7 h(k) = 92 % 8 h(k) = 6 h(k) = 84 % 8 h(k) = 4 h(k) = 32 % 8 h(k) = 0 h(k) = 90 % 8 h(k) = 2 h(k) = 69 % 8 h(k) = 5 h(k) = 97 % 8 h(k) = 1 h(k) = 91 % 8 h(k) = 3
  • 19. Sr. No. Key Element, (k) Hash Function h(k) = k mod m Buckets 1. 63 63 % 8 0 32 2. 92 92 % 8 1 97 3. 84 84 % 8 2 90 4. 32 32 % 8 3 91 5. 90 90 % 8 4 84 6. 69 69 % 8 5 69 7. 97 97 % 8 6 92 Tabular representation :-