SlideShare a Scribd company logo
1 of 23
• Keys hashed to same address is called as synonyms
Solution:
• Spread out the records
• Use extra memory
• Put more than 1 records at a single address.
A simple Hashing Algorithm
Step1:
• Step 3: divide the size of address space
a= s mod n
A=13883 mod 101
A=83
Hashing Function and Record Distributions
Some other Hashing Methods
• Examine keys for a pattern
• Fold parts of the key
• Divide the key by a number
• Square the key and take the middle.
Key=453 square= 205209 so addr=52
• Radix transformation
Key= 453 base equivalent=382 addr= 382%99=85
Predicting the Distribution of Records
Poisson Distribution
• It helps to predict the probability of collisions likely to occur in a file.
• Using Poisson function,
 It predicts no. of collisions occur
 Consider, address in file is N
 It gives 2 outcomes, when a key is hashed
1. A- address not chosen : p(A) termed as a
2. B address chosen: p(B) termed as b
If N=10,
b=1/10=0.1
a=1-0.1= 0.9
How Much Extra Memory Should Be Used?
• Poisson function applied to hashing
• To reduce the collisions, use extra memory.
• Packing Density gives the measure of amount of space in a file is used.
• If there are 75 records and 100 addresses than packing density is 75/100=0.75=75%
• Predicting collision for different packing densities
• Suppose that 1000 addresses are allocated to hold 500 records in a randomly
hashed file, and that each address can hold one record. The packing density
for the file is
Let us answer the following questions about the distribution of records among
the available addresses in the file:
• How many addresses should have no records assigned to them?
• How many addresses should have exactly one record assigned (no synonyms)?
·. ·
• How many addresses should have one record plus· one or more synonyms? - -
• Assuming that only one record can be assigned to each home address, how
many overflow records an be expected?
• What percentage of records should be overflow records?
Progressive overflow
Extendable Hashing
• Direct access (hashing) files have static size, so not suitable for files whose size is
unknown in advance
• Dynamic file structure is desired which retains the feature of fast retrieval by primary key,
and which also expands and contracts as the number of records in the file fluctuates
(without reorganizing the whole file)
• Similar motivation!
• Indexed-sequential File ==> B tree
• Hashing ==> Extendible Hashing
• How Extendible Hashing works
• Idea from Tries file (radix searching)
• The branching factor of the tree is equal to the # of alternative symbols in
each position of the key
e.g.) Radix 26 trie - able, abrahms, adams, anderson, adnrews, baird
• Use the first n characters for branching
Turning the trie into a directory
• Using Trie for extendible hashing
(1) Use Radix 2 Trie :
Keys in A : beginning with 0
Keys in B : beginning with 10
Keys in C : beginning with 11
(2) Retrieving from secondary storage the buckets containing keys,
instead of individual keys
Representation of Ties
• Rather than representing tries as a tree , it will be represented as array of
contiguous records forming a
• Directory of hash key and
• pointers to the corresponding buckets.
Extendible Hashing Example
000
001
010
011
100
101
110
111
d’=1
d’=3
d’=3
d’=2
B0
B100
B101
B11
H(key)=0
H(key)=100
H(key)=101
H(key)=11
d=3
Splitting handle overflow
• When overflow occurs
e.g.1) Overflowing of bucket A
• Split A into A and D
• Come to use additional unused bits
• No need to expand the directory
• Overflowing of bucket B
• Do not have additional unused bits
(need to expand the directory)
1. Divide B using 3 bits of hash address
2. Make a complete full binary tree
3. Collapse it into the directory structure
Dynamic Hashing
• Similar to dynamic extendible hashing
• Use a directory to track bucket addresses
• Extend the directory through the use of tries
• Start with a hash function that covers an address space of a fixed size
• When overflow occurs
• splits forming the leaves of a trie that grows down from the original
address node makes a trie
Two kinds of nodes
 External node: reference a data bucket
 Internal node: point to two children index nodes
 When a node has split children, it changed from an external node to an internal nod
1 2 3 4
4
1 2 3
40 41
4
1 3
1
410
20 21 41
411
2
Original
address
space
Original
address
space
Original
address
space
(a)
(b)
(c)

More Related Content

Similar to FS-Mod5.pptx

Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space managementrajshreemuthiah
 
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZINDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZsathiyabcsbs
 
Hashing In Data Structure Download PPT i
Hashing In Data Structure Download PPT iHashing In Data Structure Download PPT i
Hashing In Data Structure Download PPT icajiwol341
 
Hash table
Hash tableHash table
Hash tableVu Tran
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptxRajapriya82
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
B tree ,B plus and graph
B tree ,B plus and graph B tree ,B plus and graph
B tree ,B plus and graph RaaviKapoor
 
hasing introduction.pptx
hasing introduction.pptxhasing introduction.pptx
hasing introduction.pptxvvwaykule
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing TablesChinmaya M. N
 
Data Indexing Presentation-My.pptppt.ppt
Data Indexing Presentation-My.pptppt.pptData Indexing Presentation-My.pptppt.ppt
Data Indexing Presentation-My.pptppt.pptsdsm2
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its usesJawad Khan
 

Similar to FS-Mod5.pptx (20)

Deep Dive - DynamoDB
Deep Dive - DynamoDBDeep Dive - DynamoDB
Deep Dive - DynamoDB
 
Deep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDBDeep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDB
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
Hashing
HashingHashing
Hashing
 
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZINDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
 
Inverted index
Inverted indexInverted index
Inverted index
 
Hashing In Data Structure Download PPT i
Hashing In Data Structure Download PPT iHashing In Data Structure Download PPT i
Hashing In Data Structure Download PPT i
 
Hash table
Hash tableHash table
Hash table
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptx
 
Hashing
HashingHashing
Hashing
 
Hashing
HashingHashing
Hashing
 
Hashing
HashingHashing
Hashing
 
File organization 1
File organization 1File organization 1
File organization 1
 
lecture10.ppt
lecture10.pptlecture10.ppt
lecture10.ppt
 
B tree ,B plus and graph
B tree ,B plus and graph B tree ,B plus and graph
B tree ,B plus and graph
 
hasing introduction.pptx
hasing introduction.pptxhasing introduction.pptx
hasing introduction.pptx
 
02-hashing.pdf
02-hashing.pdf02-hashing.pdf
02-hashing.pdf
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing Tables
 
Data Indexing Presentation-My.pptppt.ppt
Data Indexing Presentation-My.pptppt.pptData Indexing Presentation-My.pptppt.ppt
Data Indexing Presentation-My.pptppt.ppt
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its uses
 

More from PurushottamPurshi

More from PurushottamPurshi (8)

SASE.pptx
SASE.pptxSASE.pptx
SASE.pptx
 
Lecture_6_Environmental-Pollution.ppt
Lecture_6_Environmental-Pollution.pptLecture_6_Environmental-Pollution.ppt
Lecture_6_Environmental-Pollution.ppt
 
TAPES.pptx
TAPES.pptxTAPES.pptx
TAPES.pptx
 
ST_MODULE2_6TH B_YU_PPT.pptx
ST_MODULE2_6TH B_YU_PPT.pptxST_MODULE2_6TH B_YU_PPT.pptx
ST_MODULE2_6TH B_YU_PPT.pptx
 
CONGESTION AVOIDANCE.pptx
CONGESTION AVOIDANCE.pptxCONGESTION AVOIDANCE.pptx
CONGESTION AVOIDANCE.pptx
 
Module-5.pptx
Module-5.pptxModule-5.pptx
Module-5.pptx
 
Module-2.pptx
Module-2.pptxModule-2.pptx
Module-2.pptx
 
Module-1_Introduction.pptx
Module-1_Introduction.pptxModule-1_Introduction.pptx
Module-1_Introduction.pptx
 

Recently uploaded

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
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
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
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
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
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 

Recently uploaded (20)

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
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
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
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
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
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 

FS-Mod5.pptx

  • 1.
  • 2.
  • 3. • Keys hashed to same address is called as synonyms Solution: • Spread out the records • Use extra memory • Put more than 1 records at a single address.
  • 4. A simple Hashing Algorithm Step1:
  • 5. • Step 3: divide the size of address space a= s mod n A=13883 mod 101 A=83
  • 6.
  • 7. Hashing Function and Record Distributions
  • 8. Some other Hashing Methods • Examine keys for a pattern • Fold parts of the key • Divide the key by a number • Square the key and take the middle. Key=453 square= 205209 so addr=52 • Radix transformation Key= 453 base equivalent=382 addr= 382%99=85
  • 9. Predicting the Distribution of Records Poisson Distribution • It helps to predict the probability of collisions likely to occur in a file. • Using Poisson function,  It predicts no. of collisions occur  Consider, address in file is N  It gives 2 outcomes, when a key is hashed 1. A- address not chosen : p(A) termed as a 2. B address chosen: p(B) termed as b If N=10, b=1/10=0.1 a=1-0.1= 0.9
  • 10. How Much Extra Memory Should Be Used? • Poisson function applied to hashing • To reduce the collisions, use extra memory. • Packing Density gives the measure of amount of space in a file is used. • If there are 75 records and 100 addresses than packing density is 75/100=0.75=75%
  • 11. • Predicting collision for different packing densities • Suppose that 1000 addresses are allocated to hold 500 records in a randomly hashed file, and that each address can hold one record. The packing density for the file is Let us answer the following questions about the distribution of records among the available addresses in the file: • How many addresses should have no records assigned to them? • How many addresses should have exactly one record assigned (no synonyms)? ·. · • How many addresses should have one record plus· one or more synonyms? - - • Assuming that only one record can be assigned to each home address, how many overflow records an be expected? • What percentage of records should be overflow records?
  • 13. Extendable Hashing • Direct access (hashing) files have static size, so not suitable for files whose size is unknown in advance • Dynamic file structure is desired which retains the feature of fast retrieval by primary key, and which also expands and contracts as the number of records in the file fluctuates (without reorganizing the whole file) • Similar motivation! • Indexed-sequential File ==> B tree • Hashing ==> Extendible Hashing
  • 14. • How Extendible Hashing works • Idea from Tries file (radix searching) • The branching factor of the tree is equal to the # of alternative symbols in each position of the key e.g.) Radix 26 trie - able, abrahms, adams, anderson, adnrews, baird • Use the first n characters for branching
  • 15.
  • 16. Turning the trie into a directory • Using Trie for extendible hashing (1) Use Radix 2 Trie : Keys in A : beginning with 0 Keys in B : beginning with 10 Keys in C : beginning with 11 (2) Retrieving from secondary storage the buckets containing keys, instead of individual keys
  • 17. Representation of Ties • Rather than representing tries as a tree , it will be represented as array of contiguous records forming a • Directory of hash key and • pointers to the corresponding buckets.
  • 19. Splitting handle overflow • When overflow occurs e.g.1) Overflowing of bucket A • Split A into A and D • Come to use additional unused bits • No need to expand the directory
  • 20. • Overflowing of bucket B • Do not have additional unused bits (need to expand the directory) 1. Divide B using 3 bits of hash address 2. Make a complete full binary tree 3. Collapse it into the directory structure
  • 21.
  • 22. Dynamic Hashing • Similar to dynamic extendible hashing • Use a directory to track bucket addresses • Extend the directory through the use of tries • Start with a hash function that covers an address space of a fixed size • When overflow occurs • splits forming the leaves of a trie that grows down from the original address node makes a trie Two kinds of nodes  External node: reference a data bucket  Internal node: point to two children index nodes  When a node has split children, it changed from an external node to an internal nod
  • 23. 1 2 3 4 4 1 2 3 40 41 4 1 3 1 410 20 21 41 411 2 Original address space Original address space Original address space (a) (b) (c)