SlideShare una empresa de Scribd logo
1 de 17
 Sequential search requires, on the average O(n)
 Binary search requires much fewer comparisons on the average O (log
n)
 There is another widely used technique for storing of data called
HASHING. It does away with the requirement of keeping data sorted
(as in binary search)
 In its worst case, hashing algorithm starts behaving like linear search.
 Best case timing behavior of searching using hashing = O( 1)
 Worst case timing Behavior of searching using hashing = O(n)
 In hashing, the record for a key value "key", is directly referred by
calculating the address.
 Address or location of an element or record, x, is obtained by
computing some arithmetic function f. f(key) gives the address of x in
the table.
 There are two different forms of hashing.
 Open hashing or external hashing
◦ Open or external hashing, allows records to be stored in
unlimited space (could be a hard disk). It places no limitation
on the size of the tables.
Close hashing or internal hashing
◦ Closed or internal hashing, uses a fixed space for storage and
thus limits the size of hash table.
 The basic idea is that the records [elements] are
partitioned into B classes, numbered 0,1,2 … B‐l
 A Hashing function f(x) maps a record with key n to an
integer value between 0 and B‐l.
 Each bucket in the bucket table is the head of the linked list of
records mapped to that bucket.
 A closed hash table keeps the elements in the bucket
itself.
 Only one element can be put in the bucket
 If we try to place an element in the bucket f(n) and find
it already holds an element, then we say that a collision
has occurred.
 In closed hashing, collision handling is a very
important issue.
 Characteristics of a Good Hash Function
◦ A good hash function avoids collisions.
◦ A good hash function tends to spread keys evenly in the
array.
◦ A good hash function is easy to compute.
◦ A good hash function should be quick.
 Different hashing functions
◦ Division‐Method
◦ Midsquare Methods
◦ Folding Method
◦ Digit Analysis
◦ Length Dependent Method
◦ Algebraic Coding
◦ Multiplicative Hashing
 In this method we use modular arithmetic system to divide the key value by
some integer divisor m (may be table size).
 It gives us the location value, where the element can be placed.
 We can write,
L = (K mod m) + 1
where L => location in table/file K => key value
m => table size/number of slots in file
Suppose, k = 23, m = 10 then
L = (23 mod 10) + 1= 3 + 1=4, The key whose value is 23 is placed in
4th location.
 In this case, we square the value of a key and take the
number of digits required to form an address, from
the middle position of squared value.
 Suppose a key value is 16, then its square is 256.
Now if we want address of two digits, then you select
the address as 56 (i.e. two digits starting from middle
of 256).
combine the various parts of the key in such a
way that all parts of the key affect for final result
such an operation is termed folding of the key.
That is the key is actually partitioned into number
of parts, each part having the same length as that
of the required address.
Add the value of each parts, ignoring the final
carry to get the required address.
Fold‐shifting: Here actual values of each parts of key are added.
 Suppose, the key is : 12345678, and the required address is of
two digits, Then break the key into: 12, 34, 56, 78.
 Add these, we get 12 + 34 + 56 + 78 : 180, ignore first 1 we
get 80 as location
Fold‐boundary: Here the reversed values of outer parts of key
are added.
 Suppose, the key is : 12345678, and the required address is of
two digits, Then break the key into: 21, 34, 56, 87.
 Add these, we get 21 + 34 + 56 + 87 : 198, ignore first 1 we
get 98 as location
 This hashing function is a distribution dependent.
 Here we make a statistical analysis of digits of the key, and
select those digits (of fixed position) which occur quite
frequently.
 Then reverse or shifts the digits to get the address.
 For example, if the key is : 9861234. If the statistical analysis
has revealed the fact that the third and fifth position digits
occur quite frequently, then we choose the digits in these
positions from the key. So we get, 62. Reversing it we get 26
as the address.
 In this type of hashing function we use the length of the key
along with some portion of the key j to produce the address,
directly.
 In the indirect method, the length of the key along with some
portion of the key is used to obtain intermediate value.
 Here a n bit key value is represented as a polynomial.
 The divisor polynomial is then constructed based on the
address range required.
 The modular division of key‐polynomial by divisor
polynomial, to get the address‐polynomial.
 Let f(x) = polynomial of n bit key = a1 + a2x + ……. + anxn‐1
d(x) = divisor polynomial = x1 + d1 + d2x + …. + d1x1‐1
then the required address polynomial will be f(x) mod d(x)
 This method is based on obtaining an address of a key,
based on the multiplication value.
 If k is the non‐negative key, and a constant c, (0 < c <
1), compute kc mod 1, which is a fractional part of kc.
 Multiply this fractional part by m and take a floor value
to get the address
 H(k)= | m (kc mode 1) |
 0<H(k)<m

Más contenido relacionado

La actualidad más candente

Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)Home
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing ConceptNishant Munjal
 
Topological Sorting
Topological SortingTopological Sorting
Topological SortingShahDhruv21
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure Meghaj Mallick
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 
SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithmRuchi Maurya
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its usesJawad Khan
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208Ameer Mehmood
 

La actualidad más candente (20)

Hashing data
Hashing dataHashing data
Hashing data
 
Data Structures- Hashing
Data Structures- Hashing Data Structures- Hashing
Data Structures- Hashing
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
 
Hashing
HashingHashing
Hashing
 
4.4 hashing
4.4 hashing4.4 hashing
4.4 hashing
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Hashing
HashingHashing
Hashing
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
Hashing .pptx
Hashing .pptxHashing .pptx
Hashing .pptx
 
08 Hash Tables
08 Hash Tables08 Hash Tables
08 Hash Tables
 
linear probing
linear probinglinear probing
linear probing
 
B trees dbms
B trees dbmsB trees dbms
B trees dbms
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithm
 
ElGamal Encryption Algoritham.pptx
ElGamal Encryption Algoritham.pptxElGamal Encryption Algoritham.pptx
ElGamal Encryption Algoritham.pptx
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its uses
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208
 

Destacado

Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashingJeet Poria
 
11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patil11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patilwidespreadpromotion
 
Concept of hashing
Concept of hashingConcept of hashing
Concept of hashingRafi Dar
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tablesadil raja
 
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
 

Destacado (10)

Hashing
HashingHashing
Hashing
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Ch17 Hashing
Ch17 HashingCh17 Hashing
Ch17 Hashing
 
Hashing
HashingHashing
Hashing
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patil11. Hashing - Data Structures using C++ by Varsha Patil
11. Hashing - Data Structures using C++ by Varsha Patil
 
Concept of hashing
Concept of hashingConcept of hashing
Concept of hashing
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tables
 
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
 

Similar a Hashing 1

Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptxkratika64
 
Sienna 9 hashing
Sienna 9 hashingSienna 9 hashing
Sienna 9 hashingchidabdu
 
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
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptxAgonySingh
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxSLekshmiNair
 
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
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniyaTutorialsDuniya.com
 
Data Structures Design Notes.pdf
Data Structures Design Notes.pdfData Structures Design Notes.pdf
Data Structures Design Notes.pdfAmuthachenthiruK
 
DS Unit 1.pptx
DS Unit 1.pptxDS Unit 1.pptx
DS Unit 1.pptxchin463670
 
Advance algorithm hashing lec II
Advance algorithm hashing lec IIAdvance algorithm hashing lec II
Advance algorithm hashing lec IISajid Marwat
 
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
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Kuntal Bhowmick
 
presentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxpresentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxjainaaru59
 

Similar a Hashing 1 (20)

Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptx
 
Sienna 9 hashing
Sienna 9 hashingSienna 9 hashing
Sienna 9 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.pdf
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptx
 
Lecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptxLecture14_15_Hashing.pptx
Lecture14_15_Hashing.pptx
 
Data structure Unit-I Part-C
Data structure Unit-I Part-CData structure Unit-I Part-C
Data structure Unit-I Part-C
 
Hashing
HashingHashing
Hashing
 
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
 
LECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdfLECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdf
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniya
 
Hashing.pptx
Hashing.pptxHashing.pptx
Hashing.pptx
 
Data Structures Design Notes.pdf
Data Structures Design Notes.pdfData Structures Design Notes.pdf
Data Structures Design Notes.pdf
 
DS Unit 1.pptx
DS Unit 1.pptxDS Unit 1.pptx
DS Unit 1.pptx
 
Advance algorithm hashing lec II
Advance algorithm hashing lec IIAdvance algorithm hashing lec II
Advance algorithm hashing lec II
 
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
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
 
Unit4 Part3.pptx
Unit4 Part3.pptxUnit4 Part3.pptx
Unit4 Part3.pptx
 
presentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxpresentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptx
 
Bigdata analytics
Bigdata analyticsBigdata analytics
Bigdata analytics
 
Hashing
HashingHashing
Hashing
 

Más de Shyam Khant

Más de Shyam Khant (8)

Unit2.data type, operators, control structures
Unit2.data type, operators, control structuresUnit2.data type, operators, control structures
Unit2.data type, operators, control structures
 
Introducing to core java
Introducing to core javaIntroducing to core java
Introducing to core java
 
C++
C++C++
C++
 
Php
PhpPhp
Php
 
C++ theory
C++ theoryC++ theory
C++ theory
 
C Theory
C TheoryC Theory
C Theory
 
Java script
Java scriptJava script
Java script
 
SQL
SQLSQL
SQL
 

Último

Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
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
 
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
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 

Último (20)

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
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
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
(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
 
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
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
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
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 

Hashing 1

  • 1.
  • 2.  Sequential search requires, on the average O(n)  Binary search requires much fewer comparisons on the average O (log n)  There is another widely used technique for storing of data called HASHING. It does away with the requirement of keeping data sorted (as in binary search)  In its worst case, hashing algorithm starts behaving like linear search.  Best case timing behavior of searching using hashing = O( 1)  Worst case timing Behavior of searching using hashing = O(n)  In hashing, the record for a key value "key", is directly referred by calculating the address.  Address or location of an element or record, x, is obtained by computing some arithmetic function f. f(key) gives the address of x in the table.
  • 3.
  • 4.  There are two different forms of hashing.  Open hashing or external hashing ◦ Open or external hashing, allows records to be stored in unlimited space (could be a hard disk). It places no limitation on the size of the tables. Close hashing or internal hashing ◦ Closed or internal hashing, uses a fixed space for storage and thus limits the size of hash table.
  • 5.  The basic idea is that the records [elements] are partitioned into B classes, numbered 0,1,2 … B‐l  A Hashing function f(x) maps a record with key n to an integer value between 0 and B‐l.  Each bucket in the bucket table is the head of the linked list of records mapped to that bucket.
  • 6.
  • 7.  A closed hash table keeps the elements in the bucket itself.  Only one element can be put in the bucket  If we try to place an element in the bucket f(n) and find it already holds an element, then we say that a collision has occurred.  In closed hashing, collision handling is a very important issue.
  • 8.  Characteristics of a Good Hash Function ◦ A good hash function avoids collisions. ◦ A good hash function tends to spread keys evenly in the array. ◦ A good hash function is easy to compute. ◦ A good hash function should be quick.
  • 9.  Different hashing functions ◦ Division‐Method ◦ Midsquare Methods ◦ Folding Method ◦ Digit Analysis ◦ Length Dependent Method ◦ Algebraic Coding ◦ Multiplicative Hashing
  • 10.  In this method we use modular arithmetic system to divide the key value by some integer divisor m (may be table size).  It gives us the location value, where the element can be placed.  We can write, L = (K mod m) + 1 where L => location in table/file K => key value m => table size/number of slots in file Suppose, k = 23, m = 10 then L = (23 mod 10) + 1= 3 + 1=4, The key whose value is 23 is placed in 4th location.
  • 11.  In this case, we square the value of a key and take the number of digits required to form an address, from the middle position of squared value.  Suppose a key value is 16, then its square is 256. Now if we want address of two digits, then you select the address as 56 (i.e. two digits starting from middle of 256).
  • 12. combine the various parts of the key in such a way that all parts of the key affect for final result such an operation is termed folding of the key. That is the key is actually partitioned into number of parts, each part having the same length as that of the required address. Add the value of each parts, ignoring the final carry to get the required address.
  • 13. Fold‐shifting: Here actual values of each parts of key are added.  Suppose, the key is : 12345678, and the required address is of two digits, Then break the key into: 12, 34, 56, 78.  Add these, we get 12 + 34 + 56 + 78 : 180, ignore first 1 we get 80 as location Fold‐boundary: Here the reversed values of outer parts of key are added.  Suppose, the key is : 12345678, and the required address is of two digits, Then break the key into: 21, 34, 56, 87.  Add these, we get 21 + 34 + 56 + 87 : 198, ignore first 1 we get 98 as location
  • 14.  This hashing function is a distribution dependent.  Here we make a statistical analysis of digits of the key, and select those digits (of fixed position) which occur quite frequently.  Then reverse or shifts the digits to get the address.  For example, if the key is : 9861234. If the statistical analysis has revealed the fact that the third and fifth position digits occur quite frequently, then we choose the digits in these positions from the key. So we get, 62. Reversing it we get 26 as the address.
  • 15.  In this type of hashing function we use the length of the key along with some portion of the key j to produce the address, directly.  In the indirect method, the length of the key along with some portion of the key is used to obtain intermediate value.
  • 16.  Here a n bit key value is represented as a polynomial.  The divisor polynomial is then constructed based on the address range required.  The modular division of key‐polynomial by divisor polynomial, to get the address‐polynomial.  Let f(x) = polynomial of n bit key = a1 + a2x + ……. + anxn‐1 d(x) = divisor polynomial = x1 + d1 + d2x + …. + d1x1‐1 then the required address polynomial will be f(x) mod d(x)
  • 17.  This method is based on obtaining an address of a key, based on the multiplication value.  If k is the non‐negative key, and a constant c, (0 < c < 1), compute kc mod 1, which is a fractional part of kc.  Multiply this fractional part by m and take a floor value to get the address  H(k)= | m (kc mode 1) |  0<H(k)<m