SlideShare a Scribd company logo
1 of 14
EXTENDIBLE HASHING
B.KOHILA
I –Msc(IT)
 Extendible hashing
 Expandable and dynamic hashing
 Virtual hashing
 Summary
2
OUTLINE
3
 Standard hashing works on fixed file size.
 What if we add / delete many keys?
What if the file sizes change significantly?
 Then we will develop separate techniques.
Two types:
- Directory schemes
- Directory less schemes
Hash Functions for Extendible Hashing
4
 Keys stored in buckets.
 Each bucket can only hold a fixed size of items.
 Index is an extendible table;
h(x) hashes a key value x to a bit map;
only a portion of a bit map is used to build a directory.
Example: buckets h(kn) = 11011
Add kn
b00 ********************************
b00
b01 b01
b10
Table
b1 b11
Extendible Hashing
00011
00110
00101
01100
01011
10011
11110
11111
00
01
10
11
00
01
10
11
10011
11011
11110
11111
5
 Directory schemes
- Extendible Hashing (Fagin et. al. 1979)
- Expandable hashing (Knott 1971)
- Dynamic Hashing (Larson 1978)
 Directory less schemes
- Virtual hashing (Litwin 1978)
Hash Functions for Extendible Hashing
6
 Size of a bucket = MAX # of pseudokeys (3 in our example)
 Once the bucket is full –
split the bucket into two
Two situation will be possible:
- Directory remains of the same size
adjust pointer to a bucket
- Size of directory grows from 2k to 2k+1
i.e. directory size can be 1, 2, 4, 8, 16 etc
(8 is shown in the figure).
The number of buckets will remain the same,
i.e. some references will point to the same bucket.
Finally, one can use bitmap to build the index but store an actual key in
the bucket!
Extendible Hashing
000
001
010
011
100
101
110
111
7
1. Use as much space as needed.
2. Input the file name, # of words to insert
Use bucket size: 128
3. Use any function h(k) that returns the string of bits of up to
32 bits (integer type can be used).
4. Bucket – char array
5. Main idea: only the FIRST bits of the mask are used for
search
Extendible Hashing
8
Assume that a hashing technique is applied to a dynamically changing file
composed of buckets, and each bucket can hold only a fixed number of items.
Extendible hashing accesses the data stored in
buckets indirectly through an index that is
dynamically adjusted to reflect changes in the file.
The characteristic feature of extendible hashing is the organization of the
index, which is an expandable table.
Extendible Hashing
9
 A hash function applied to a certain key indicates a position in the index
and not in the file (or table or keys). Values returned by such a hash
function are called pseudokeys.
 The file requires no reorganization when data are added to or deleted
from it, since these changes are indicated in the index.
Only one hash function h can be used, but depending on the size of the
index, only a portion of the added h(K) is utilized.
 A simple way to achieve this effect is by looking at the address into the
string of bits from which only the i leftmost bits can be used.
The number i is the depth of the directory.
In figure 1(a) (in the next slide), the depth is equal to two.
Extendible Hashing
10
Extendible Hashing
Figure 1. An example of extendible hashing
(Drozdek Textbook)
11
Expandable Hashing
 Similar idea to an extendible hashing.
But binary tree is used to store an index on the buckets.
Dynamic Hashing
 multiple binary trees are used.
Outcome:
- To shorten the search.
- Based on the key --- select what tree to search.
Expandable & Dynamic Hashing
12
 Larson method
 Index is simplified to be represented as a set of binary
trees.
 Height of each tree is limited.
 h(x) is searched in ALL trees.
Time: m – trees, k keys in each max, overall: m*lgk.
Advantage: shorter search time in index file
Dynamic Hashing
13
Litwin’s Virtual Hashing
 Expand buckets in a linear fashion.
 Store them continuously in the memory.
 No table is needed, the procedure is simple.
Virtual Hashing
14
Summary
 Extendible hashing advantages:
 Initially allocated space can increase indefinitely
 Location of a bucket where key belongs requires only very fast bits
comparison
 Very flexible in choosing size of the bucket, and allows their storage on
disks/remote memory access
 Extendible hashing disadvantages:
 Increased algorithm complexity
 Extra memory overhead to store index inside the bucket

More Related Content

What's hot

Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data StructureDharita Chokshi
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Presentation on Elementary data structures
Presentation on Elementary data structuresPresentation on Elementary data structures
Presentation on Elementary data structuresKuber Chandra
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its typesRameesha Sadaqat
 
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
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AIAmey Kerkar
 
Applications of data structures
Applications of data structuresApplications of data structures
Applications of data structuresWipro
 
UNIT I LINEAR DATA STRUCTURES – LIST
UNIT I 	LINEAR DATA STRUCTURES – LIST 	UNIT I 	LINEAR DATA STRUCTURES – LIST
UNIT I LINEAR DATA STRUCTURES – LIST Kathirvel Ayyaswamy
 
Applications of stack
Applications of stackApplications of stack
Applications of stackeShikshak
 

What's hot (20)

Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
stack & queue
stack & queuestack & queue
stack & queue
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Presentation on Elementary data structures
Presentation on Elementary data structuresPresentation on Elementary data structures
Presentation on Elementary data structures
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its types
 
Heaps
HeapsHeaps
Heaps
 
search strategies in artificial intelligence
search strategies in artificial intelligencesearch strategies in artificial intelligence
search strategies in artificial intelligence
 
Binary Tree Traversal
Binary Tree TraversalBinary Tree Traversal
Binary Tree Traversal
 
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
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Binary search
Binary searchBinary search
Binary search
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AI
 
Applications of data structures
Applications of data structuresApplications of data structures
Applications of data structures
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
UNIT I LINEAR DATA STRUCTURES – LIST
UNIT I 	LINEAR DATA STRUCTURES – LIST 	UNIT I 	LINEAR DATA STRUCTURES – LIST
UNIT I LINEAR DATA STRUCTURES – LIST
 
Stack
StackStack
Stack
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 

Similar to Extensible hashing

4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashingKrish_ver2
 
Hash Table.pptx
Hash Table.pptxHash Table.pptx
Hash Table.pptxMBablu1
 
introduction to trees,graphs,hashing
introduction to trees,graphs,hashingintroduction to trees,graphs,hashing
introduction to trees,graphs,hashingAkhil Prem
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management Systemsweetysweety8
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptxRajapriya82
 
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-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptx
Lecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptxLecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptx
Lecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptxROHIT738213
 
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZINDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZsathiyabcsbs
 
Bloom Filters: An Introduction
Bloom Filters: An IntroductionBloom Filters: An Introduction
Bloom Filters: An IntroductionIRJET Journal
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tablesadil raja
 
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
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing extKrish_ver2
 
files,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingfiles,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingRohit Kumar
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...Javed Khan
 

Similar to Extensible hashing (20)

4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 
Hash Table.pptx
Hash Table.pptxHash Table.pptx
Hash Table.pptx
 
introduction to trees,graphs,hashing
introduction to trees,graphs,hashingintroduction to trees,graphs,hashing
introduction to trees,graphs,hashing
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Unit4 Part3.pptx
Unit4 Part3.pptxUnit4 Part3.pptx
Unit4 Part3.pptx
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.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
 
02-hashing.pdf
02-hashing.pdf02-hashing.pdf
02-hashing.pdf
 
Lecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptx
Lecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptxLecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptx
Lecture14-Hash-Based-Indexing-and-Sorting-MHH-18Oct-2016.pptx
 
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZINDEXING AND HASHING UNIT 4 SILBERSCHATZ
INDEXING AND HASHING UNIT 4 SILBERSCHATZ
 
Bloom Filters: An Introduction
Bloom Filters: An IntroductionBloom Filters: An Introduction
Bloom Filters: An Introduction
 
Hashing and Hash Tables
Hashing and Hash TablesHashing and Hash Tables
Hashing and Hash Tables
 
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
 
Assignment#12
Assignment#12Assignment#12
Assignment#12
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing ext
 
Hashing
HashingHashing
Hashing
 
Lec 1 indexing and hashing
Lec 1 indexing and hashing Lec 1 indexing and hashing
Lec 1 indexing and hashing
 
files,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingfiles,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashing
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
 
Indexing.ppt
Indexing.pptIndexing.ppt
Indexing.ppt
 

More from rajshreemuthiah (20)

oracle
oracleoracle
oracle
 
quality
qualityquality
quality
 
bigdata
bigdatabigdata
bigdata
 
polymorphism
polymorphismpolymorphism
polymorphism
 
solutions and understanding text analytics
solutions and understanding text analyticssolutions and understanding text analytics
solutions and understanding text analytics
 
interface
interfaceinterface
interface
 
Testing &ampdebugging
Testing &ampdebuggingTesting &ampdebugging
Testing &ampdebugging
 
concurrency control
concurrency controlconcurrency control
concurrency control
 
Education
EducationEducation
Education
 
Formal verification
Formal verificationFormal verification
Formal verification
 
Transaction management
Transaction management Transaction management
Transaction management
 
Multi thread
Multi threadMulti thread
Multi thread
 
System testing
System testingSystem testing
System testing
 
software maintenance
software maintenancesoftware maintenance
software maintenance
 
exception handling
exception handlingexception handling
exception handling
 
e governance
e governancee governance
e governance
 
recovery management
recovery managementrecovery management
recovery management
 
Implementing polymorphism
Implementing polymorphismImplementing polymorphism
Implementing polymorphism
 
Buffer managements
Buffer managementsBuffer managements
Buffer managements
 
os linux
os linuxos linux
os linux
 

Recently uploaded

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Extensible hashing

  • 2.  Extendible hashing  Expandable and dynamic hashing  Virtual hashing  Summary 2 OUTLINE
  • 3. 3  Standard hashing works on fixed file size.  What if we add / delete many keys? What if the file sizes change significantly?  Then we will develop separate techniques. Two types: - Directory schemes - Directory less schemes Hash Functions for Extendible Hashing
  • 4. 4  Keys stored in buckets.  Each bucket can only hold a fixed size of items.  Index is an extendible table; h(x) hashes a key value x to a bit map; only a portion of a bit map is used to build a directory. Example: buckets h(kn) = 11011 Add kn b00 ******************************** b00 b01 b01 b10 Table b1 b11 Extendible Hashing 00011 00110 00101 01100 01011 10011 11110 11111 00 01 10 11 00 01 10 11 10011 11011 11110 11111
  • 5. 5  Directory schemes - Extendible Hashing (Fagin et. al. 1979) - Expandable hashing (Knott 1971) - Dynamic Hashing (Larson 1978)  Directory less schemes - Virtual hashing (Litwin 1978) Hash Functions for Extendible Hashing
  • 6. 6  Size of a bucket = MAX # of pseudokeys (3 in our example)  Once the bucket is full – split the bucket into two Two situation will be possible: - Directory remains of the same size adjust pointer to a bucket - Size of directory grows from 2k to 2k+1 i.e. directory size can be 1, 2, 4, 8, 16 etc (8 is shown in the figure). The number of buckets will remain the same, i.e. some references will point to the same bucket. Finally, one can use bitmap to build the index but store an actual key in the bucket! Extendible Hashing 000 001 010 011 100 101 110 111
  • 7. 7 1. Use as much space as needed. 2. Input the file name, # of words to insert Use bucket size: 128 3. Use any function h(k) that returns the string of bits of up to 32 bits (integer type can be used). 4. Bucket – char array 5. Main idea: only the FIRST bits of the mask are used for search Extendible Hashing
  • 8. 8 Assume that a hashing technique is applied to a dynamically changing file composed of buckets, and each bucket can hold only a fixed number of items. Extendible hashing accesses the data stored in buckets indirectly through an index that is dynamically adjusted to reflect changes in the file. The characteristic feature of extendible hashing is the organization of the index, which is an expandable table. Extendible Hashing
  • 9. 9  A hash function applied to a certain key indicates a position in the index and not in the file (or table or keys). Values returned by such a hash function are called pseudokeys.  The file requires no reorganization when data are added to or deleted from it, since these changes are indicated in the index. Only one hash function h can be used, but depending on the size of the index, only a portion of the added h(K) is utilized.  A simple way to achieve this effect is by looking at the address into the string of bits from which only the i leftmost bits can be used. The number i is the depth of the directory. In figure 1(a) (in the next slide), the depth is equal to two. Extendible Hashing
  • 10. 10 Extendible Hashing Figure 1. An example of extendible hashing (Drozdek Textbook)
  • 11. 11 Expandable Hashing  Similar idea to an extendible hashing. But binary tree is used to store an index on the buckets. Dynamic Hashing  multiple binary trees are used. Outcome: - To shorten the search. - Based on the key --- select what tree to search. Expandable & Dynamic Hashing
  • 12. 12  Larson method  Index is simplified to be represented as a set of binary trees.  Height of each tree is limited.  h(x) is searched in ALL trees. Time: m – trees, k keys in each max, overall: m*lgk. Advantage: shorter search time in index file Dynamic Hashing
  • 13. 13 Litwin’s Virtual Hashing  Expand buckets in a linear fashion.  Store them continuously in the memory.  No table is needed, the procedure is simple. Virtual Hashing
  • 14. 14 Summary  Extendible hashing advantages:  Initially allocated space can increase indefinitely  Location of a bucket where key belongs requires only very fast bits comparison  Very flexible in choosing size of the bucket, and allows their storage on disks/remote memory access  Extendible hashing disadvantages:  Increased algorithm complexity  Extra memory overhead to store index inside the bucket