Posts

Hashing in Data Structure | Collision Resolution Techniques | Hashing in DBMS

  Hashing in DBMS Hashing is a technique used to map data elements (keys) to specific locations in a hash table using a hash function. It allows insertion and retrieval of data efficiently     Hash Function A hash function converts a key into a hash code (index) , which is used to store and retrieve the data from a hash table.                                 h(k)=k mod m Where: k → Key m → Hash table size h(k) → Hash index  Hash Table A hash table is a data structure that stores data in an array format . Each position in the table is called a bucket , and the position is accessed using the hash function. Example Consider Keys                   (k) = 11, 18, 20, 25, 29, 33 Hash table size (m) = 7 Hash function:    h(k)=k mod m                     ...

Dynamic Hashing in Data structure| Dynamic Hashing in DBMS |Extendible Hashing in Data structure

  Dynamic Hashing Dynamic Hashing allows the hash table to grow or shrink dynamically according to the amount of data. The number of buckets changes dynamically. Bucket overflow is handled by splitting or expanding . It is suitable for storing large amounts of data. Extendible Hashing Extendible Hashing is a dynamic hashing technique. It uses a directory with Global Depth. Each bucket has a Local Depth .(Last bit) When a bucket becomes full, it is split into two buckets. If required, the directory size is doubled. It uses suffix bits (last bits) to identify the buckets. Example Values = 11, 18, 20, 25, 29, 33 Bucket Size = 2(Cannot store more than 2 value) Binary Representation Value Binary Last 1 Bit Last 2 Bits Last 3 Bits 11 1011 1 11 011 18 10010 0 10 010 ...