SlideShare une entreprise Scribd logo
1  sur  16
HASHING IN DATA
STRUCTURES
BY SIMRAN PARDESHI (36) , PRATHAM PATEL (37), VEDANT PATHAK (38), RUSHIKESH PEDGULWAR (40)
CONTENT:
1. Introduction
2. Collision Resolution Techniques
3. Hash Table using Linear Probing
4. Result & Discussion
5. Conclusion
INTRODUCTION:
 What is Hashing?
 Hashing is the process of converting a given key into another value. A hash function is used to generate
the new value according to a mathematical algorithm. The result of a hash function is known as a hash
value or simply, a hash.
INTRODUCTION (CONTD.)
 It is a technique or process of mapping keys, values into the hash table by using a hash function. It is
done for faster access to elements. The efficiency of mapping depends on the efficiency of the hash
function used.
COLLISION RESOLUTION TECHNIQUES
 What is Collision?
 Keep in mind that two keys can generate the same hash. This phenomenon is known as a collision.
 Since a hash function gets us a small number for a key which is a big integer or string, there is a possibility that two
keys result in the same value. The situation where a newly inserted key maps to an already occupied slot in the hash
table is called collision and must be handled using some collision handling technique.
COLLISION RESOLUTION TECHNIQUES (CONTD.)
E.g. Consider the following keys: (16,21,26,20)
Size of the Hash Table is 3.
Now we will start inserting the keys.
For 16 = 16 % 4= 0
21 = 21% 4 = 1
26 = 26 % 4 = 2
20 = 20 % 4 = 0
For the last key (20), there is already an element where 20 is to be inserted,
This is where Collision Resolution Technique comes into picture.
0
1
2
16
21
26
3
COLLISION RESOLUTION TECHNIQUES (CONTD.)
COLLISION RESOLUTION
TECHNIQUES
Chaining
(Open Hashing)
Open Addressing
(Closed Hashing)
1. Linear Probing
2. Quadratic Probing
3. Double Hashing
LINEAR PROBING
 In these schemes, each cell of a hash table stores a single key–value pair. When the hash function causes
a collision by mapping a new key to a cell of the hash table that is already occupied by another key,
linear probing searches the table for the closest following free location and inserts the new key there.
 E.g. Let us consider a simple hash function as “key mod 7” and a sequence of keys as 50, 700, 76, 85, 92,
73, 101.
PROS AND CONS:
 The advantages of linear probing are as follows −
Linear probing requires very less memory.
It is less complex and is simpler to implement.
 The disadvantages of linear probing are as follows −
Linear probing causes a scenario called "primary clustering" in which there are large blocks of
occupied cells within the hash table.
The values in linear probing tend to cluster which makes the probe sequence longer and
lengthier.
HASH TABLE USING LINEAR PROBING:
HASH TABLE USING LINEAR PROBING (CONTD.)
HASH TABLE USING LINEAR PROBING (CONTD.)
HASH TABLE USING LINEAR PROBING (CONTD.)
RESULT & DISCUSSION:
 Hashing is most commonly used to implement hash tables. A hash table stores key/value pairs in the
form of a list where any element can be accessed using its index.
 Since there is no limit to the number of key/value pairs, we can use a hash function to map the keys to
the size of the table; the hash value becomes the index for a given element.
 A simple hashing approach would be to take the modular of the key (assuming it’s numerical) against
the table’s size:
 index = key text{ } MOD text{ } tableSizeindex=key MOD tableSize
 This will ensure that the hash is always within the limits of the table size.
CONCLUSION:
 Hash tables are used to store data using a pair of keys and values.
 A hash function uses a mathematical algorithm to calculate the hash value.
 A collision occurs when the same hash value is generated for more than one value.
 Chaining solves collision by creating linked lists.
 Probing solves collision by finding empty slots in the hash table.
 Linear probing searches for the next free slot to store the value starting from the slot where the collision occurred.
 Quadratic probing uses polynomial expressions to find the next free slot when a collision occurs.
 Double hashing uses a secondary hash function algorithm to find the next free slot when a collision occurs.
 Hash tables have better performance when compared to other data structures.
 The average time complexity of hash tables is O (1)
 A dictionary data type in python is an example of a hash table.
 Hash tables support insert, search and delete operations.
 A null value cannot be used as an index value.
THANK YOU

Contenu connexe

Tendances

Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data StructuresSHAKOOR AB
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm03446940736
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithmAamir Sohail
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)Elavarasi K
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureBalwant Gorad
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data StructureAnuj Modi
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure Meghaj Mallick
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeManishPrajapati78
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxPolynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxAlbin562191
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structureghhgj jhgh
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler DesignKuppusamy P
 

Tendances (20)

Hash table
Hash tableHash table
Hash table
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
Hashing
HashingHashing
Hashing
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithm
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Hashing
HashingHashing
Hashing
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptxPolynomial reppresentation using Linkedlist-Application of LL.pptx
Polynomial reppresentation using Linkedlist-Application of LL.pptx
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
 

Similaire à Data Structures : hashing (1)

Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptxAgonySingh
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptxkratika64
 
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
 
Data Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table pptData Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table pptJUSTFUN40
 
Hashing and separate chain
Hashing and separate chainHashing and separate chain
Hashing and separate chainVijayapriyaPandi
 
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
 
How Hashmap works internally in java
How Hashmap works internally  in javaHow Hashmap works internally  in java
How Hashmap works internally in javaRamakrishna Joshi
 
Advance algorithm hashing lec II
Advance algorithm hashing lec IIAdvance algorithm hashing lec II
Advance algorithm hashing lec IISajid Marwat
 
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
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxSLekshmiNair
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structureMahmoud Alfarra
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tablesadil raja
 

Similaire à Data Structures : hashing (1) (20)

Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptx
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptx
 
Hashing
HashingHashing
Hashing
 
DS THEORY 35.pptx
DS THEORY 35.pptxDS THEORY 35.pptx
DS THEORY 35.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
 
Hashing data
Hashing dataHashing data
Hashing data
 
Data Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table pptData Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table ppt
 
linear probing
linear probinglinear probing
linear probing
 
Hashing and separate chain
Hashing and separate chainHashing and separate chain
Hashing and separate chain
 
asdfew.pptx
asdfew.pptxasdfew.pptx
asdfew.pptx
 
Hashing
HashingHashing
Hashing
 
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
 
How Hashmap works internally in java
How Hashmap works internally  in javaHow Hashmap works internally  in java
How Hashmap works internally in java
 
Ds 8
Ds 8Ds 8
Ds 8
 
Advance algorithm hashing lec II
Advance algorithm hashing lec IIAdvance algorithm hashing lec II
Advance algorithm hashing lec II
 
HASHING.ppt.pptx
HASHING.ppt.pptxHASHING.ppt.pptx
HASHING.ppt.pptx
 
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
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptx
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tables
 

Plus de Home

DIABETES PREDICTION SYSTEM .pptx
DIABETES PREDICTION SYSTEM .pptxDIABETES PREDICTION SYSTEM .pptx
DIABETES PREDICTION SYSTEM .pptxHome
 
data science pptx
data science pptxdata science pptx
data science pptxHome
 
HARDWARE AND SOFTWARE.pptx
HARDWARE AND SOFTWARE.pptxHARDWARE AND SOFTWARE.pptx
HARDWARE AND SOFTWARE.pptxHome
 
Rock ,Paper, Scissors IAI .pptx
Rock ,Paper, Scissors IAI .pptxRock ,Paper, Scissors IAI .pptx
Rock ,Paper, Scissors IAI .pptxHome
 
Graph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxGraph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxHome
 
Fighting climate change using agritech
Fighting climate change using agritech Fighting climate change using agritech
Fighting climate change using agritech Home
 
APPLICATION OF GROUPS IN CRYPTOGRAPHY
APPLICATION OF GROUPS IN CRYPTOGRAPHYAPPLICATION OF GROUPS IN CRYPTOGRAPHY
APPLICATION OF GROUPS IN CRYPTOGRAPHYHome
 
ECONOMIC RIGHTS.pptx
ECONOMIC RIGHTS.pptxECONOMIC RIGHTS.pptx
ECONOMIC RIGHTS.pptxHome
 
Hamiltonian cycle in data structure 2
Hamiltonian cycle in data structure  2Hamiltonian cycle in data structure  2
Hamiltonian cycle in data structure 2Home
 
Water scarcity and its remedial measures
Water scarcity and its remedial measuresWater scarcity and its remedial measures
Water scarcity and its remedial measuresHome
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python Home
 
Multimedia operating system
Multimedia operating systemMultimedia operating system
Multimedia operating systemHome
 
Dsdco IE: RISC and CISC architectures and design issues
Dsdco IE: RISC and CISC architectures and design issuesDsdco IE: RISC and CISC architectures and design issues
Dsdco IE: RISC and CISC architectures and design issuesHome
 
Dbms mini project
Dbms mini projectDbms mini project
Dbms mini projectHome
 
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFEIMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFEHome
 
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGEACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGEHome
 
SMART WASTE MANAGEMENT AND RAINWATER HARVESTING
SMART WASTE MANAGEMENT AND RAINWATER HARVESTINGSMART WASTE MANAGEMENT AND RAINWATER HARVESTING
SMART WASTE MANAGEMENT AND RAINWATER HARVESTINGHome
 
Rock , paper and scissors game made with PYTHON
Rock , paper and  scissors game made with PYTHON Rock , paper and  scissors game made with PYTHON
Rock , paper and scissors game made with PYTHON Home
 
Chemistry (biomass and recyclable polymers)
Chemistry (biomass and recyclable polymers)Chemistry (biomass and recyclable polymers)
Chemistry (biomass and recyclable polymers)Home
 
Basic electrical engineering (Autotransformer)
Basic electrical engineering (Autotransformer)Basic electrical engineering (Autotransformer)
Basic electrical engineering (Autotransformer)Home
 

Plus de Home (20)

DIABETES PREDICTION SYSTEM .pptx
DIABETES PREDICTION SYSTEM .pptxDIABETES PREDICTION SYSTEM .pptx
DIABETES PREDICTION SYSTEM .pptx
 
data science pptx
data science pptxdata science pptx
data science pptx
 
HARDWARE AND SOFTWARE.pptx
HARDWARE AND SOFTWARE.pptxHARDWARE AND SOFTWARE.pptx
HARDWARE AND SOFTWARE.pptx
 
Rock ,Paper, Scissors IAI .pptx
Rock ,Paper, Scissors IAI .pptxRock ,Paper, Scissors IAI .pptx
Rock ,Paper, Scissors IAI .pptx
 
Graph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxGraph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptx
 
Fighting climate change using agritech
Fighting climate change using agritech Fighting climate change using agritech
Fighting climate change using agritech
 
APPLICATION OF GROUPS IN CRYPTOGRAPHY
APPLICATION OF GROUPS IN CRYPTOGRAPHYAPPLICATION OF GROUPS IN CRYPTOGRAPHY
APPLICATION OF GROUPS IN CRYPTOGRAPHY
 
ECONOMIC RIGHTS.pptx
ECONOMIC RIGHTS.pptxECONOMIC RIGHTS.pptx
ECONOMIC RIGHTS.pptx
 
Hamiltonian cycle in data structure 2
Hamiltonian cycle in data structure  2Hamiltonian cycle in data structure  2
Hamiltonian cycle in data structure 2
 
Water scarcity and its remedial measures
Water scarcity and its remedial measuresWater scarcity and its remedial measures
Water scarcity and its remedial measures
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python
 
Multimedia operating system
Multimedia operating systemMultimedia operating system
Multimedia operating system
 
Dsdco IE: RISC and CISC architectures and design issues
Dsdco IE: RISC and CISC architectures and design issuesDsdco IE: RISC and CISC architectures and design issues
Dsdco IE: RISC and CISC architectures and design issues
 
Dbms mini project
Dbms mini projectDbms mini project
Dbms mini project
 
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFEIMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
 
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGEACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
 
SMART WASTE MANAGEMENT AND RAINWATER HARVESTING
SMART WASTE MANAGEMENT AND RAINWATER HARVESTINGSMART WASTE MANAGEMENT AND RAINWATER HARVESTING
SMART WASTE MANAGEMENT AND RAINWATER HARVESTING
 
Rock , paper and scissors game made with PYTHON
Rock , paper and  scissors game made with PYTHON Rock , paper and  scissors game made with PYTHON
Rock , paper and scissors game made with PYTHON
 
Chemistry (biomass and recyclable polymers)
Chemistry (biomass and recyclable polymers)Chemistry (biomass and recyclable polymers)
Chemistry (biomass and recyclable polymers)
 
Basic electrical engineering (Autotransformer)
Basic electrical engineering (Autotransformer)Basic electrical engineering (Autotransformer)
Basic electrical engineering (Autotransformer)
 

Dernier

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
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
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Dernier (20)

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
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...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Data Structures : hashing (1)

  • 1. HASHING IN DATA STRUCTURES BY SIMRAN PARDESHI (36) , PRATHAM PATEL (37), VEDANT PATHAK (38), RUSHIKESH PEDGULWAR (40)
  • 2. CONTENT: 1. Introduction 2. Collision Resolution Techniques 3. Hash Table using Linear Probing 4. Result & Discussion 5. Conclusion
  • 3. INTRODUCTION:  What is Hashing?  Hashing is the process of converting a given key into another value. A hash function is used to generate the new value according to a mathematical algorithm. The result of a hash function is known as a hash value or simply, a hash.
  • 4. INTRODUCTION (CONTD.)  It is a technique or process of mapping keys, values into the hash table by using a hash function. It is done for faster access to elements. The efficiency of mapping depends on the efficiency of the hash function used.
  • 5. COLLISION RESOLUTION TECHNIQUES  What is Collision?  Keep in mind that two keys can generate the same hash. This phenomenon is known as a collision.  Since a hash function gets us a small number for a key which is a big integer or string, there is a possibility that two keys result in the same value. The situation where a newly inserted key maps to an already occupied slot in the hash table is called collision and must be handled using some collision handling technique.
  • 6. COLLISION RESOLUTION TECHNIQUES (CONTD.) E.g. Consider the following keys: (16,21,26,20) Size of the Hash Table is 3. Now we will start inserting the keys. For 16 = 16 % 4= 0 21 = 21% 4 = 1 26 = 26 % 4 = 2 20 = 20 % 4 = 0 For the last key (20), there is already an element where 20 is to be inserted, This is where Collision Resolution Technique comes into picture. 0 1 2 16 21 26 3
  • 7. COLLISION RESOLUTION TECHNIQUES (CONTD.) COLLISION RESOLUTION TECHNIQUES Chaining (Open Hashing) Open Addressing (Closed Hashing) 1. Linear Probing 2. Quadratic Probing 3. Double Hashing
  • 8. LINEAR PROBING  In these schemes, each cell of a hash table stores a single key–value pair. When the hash function causes a collision by mapping a new key to a cell of the hash table that is already occupied by another key, linear probing searches the table for the closest following free location and inserts the new key there.  E.g. Let us consider a simple hash function as “key mod 7” and a sequence of keys as 50, 700, 76, 85, 92, 73, 101.
  • 9. PROS AND CONS:  The advantages of linear probing are as follows − Linear probing requires very less memory. It is less complex and is simpler to implement.  The disadvantages of linear probing are as follows − Linear probing causes a scenario called "primary clustering" in which there are large blocks of occupied cells within the hash table. The values in linear probing tend to cluster which makes the probe sequence longer and lengthier.
  • 10. HASH TABLE USING LINEAR PROBING:
  • 11. HASH TABLE USING LINEAR PROBING (CONTD.)
  • 12. HASH TABLE USING LINEAR PROBING (CONTD.)
  • 13. HASH TABLE USING LINEAR PROBING (CONTD.)
  • 14. RESULT & DISCUSSION:  Hashing is most commonly used to implement hash tables. A hash table stores key/value pairs in the form of a list where any element can be accessed using its index.  Since there is no limit to the number of key/value pairs, we can use a hash function to map the keys to the size of the table; the hash value becomes the index for a given element.  A simple hashing approach would be to take the modular of the key (assuming it’s numerical) against the table’s size:  index = key text{ } MOD text{ } tableSizeindex=key MOD tableSize  This will ensure that the hash is always within the limits of the table size.
  • 15. CONCLUSION:  Hash tables are used to store data using a pair of keys and values.  A hash function uses a mathematical algorithm to calculate the hash value.  A collision occurs when the same hash value is generated for more than one value.  Chaining solves collision by creating linked lists.  Probing solves collision by finding empty slots in the hash table.  Linear probing searches for the next free slot to store the value starting from the slot where the collision occurred.  Quadratic probing uses polynomial expressions to find the next free slot when a collision occurs.  Double hashing uses a secondary hash function algorithm to find the next free slot when a collision occurs.  Hash tables have better performance when compared to other data structures.  The average time complexity of hash tables is O (1)  A dictionary data type in python is an example of a hash table.  Hash tables support insert, search and delete operations.  A null value cannot be used as an index value.