Hashing tedifferent cloudchninqueee.pptx

athul369kuttath 6 views 17 slides Oct 29, 2025
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

The document discusses cloud computing, including what it is, its history and benefits. It defines cloud as the delivery of computing services over the internet and discusses common cloud characteristics like on-demand self-service and rapid elasticity. It describes the different cloud models includ...


Slide Content

Hashing Rahul r p

Hashing Hashing is a primary file organization method that provides fast access to records under certain search conditions. Hashing is a method used to organize and store data in a way that lets us find records quickly. In this method, the data is stored in a hash file, and we use a search condition based on equality—meaning we're looking for records where a specific field exactly matches a given value. That specific field is called the hash field, and it's usually a unique identifier like a key, so we often call it the hash key.

Hashing A function h, called the hash function or randomizing function, is applied to the hash field value. It produces the address of the disk block where the record is stored. Usually, only a single-block access is needed to fetch the record.

Internal Hashing Used for internal files with a hash table (array of records) . Array index ranges from 0 to M−1 , where M is total slots. A hash function transforms the hash key K into an integer in that range. Common Hash Function: h(K) = K mod M For non-integer hash fields (like strings), convert to integers (e.g., ASCII codes ).

Internal Hashing Used for internal files with a hash table (array of records) . Array index ranges from 0 to M−1 , where M is total slots. A hash function transforms the hash key K into an integer in that range. Common Hash Function: h(K) = K mod M For non-integer hash fields (like strings), convert to integers (e.g., ASCII codes ).

FOLDING METHOD In this method we divide the key value in two parts. And then we add them. FOR EXAMPLE: K= 4012 1027 40+12=52 10+27=37 J=52 J=37 Here J is the value which we obtain by adding the KEY value.

Collision in Hashing A collision occurs when: The hash field value of a new record Hashes to an address that is already occupied by another record. In such cases, we cannot insert the new record at the hashed address. Therefore, we must find an alternative position for the new record. This process is called collision resolution .

Open Addressing If the hash address is already occupied , the program: Checks the next position in the array. Continues checking sequentially until an empty slot is found. This method avoids using extra memory like pointers or overflow areas.

Chaining Uses overflow locations to handle collisions. The array is extended with extra slots (overflow space). Each record location has a pointer field . When a collision occurs: The new record is placed in a free overflow location . The pointer in the original (occupied) location is updated to point to the new record. This forms a linked list of overflow records for each hash address.

Multiple Hashing If a collision occurs at the first hash: A second hash function is applied to compute a new address. If that also results in a collision: The program may: Use open addressing , or Apply a third hash function .

EXTERNAL HASHING External hashing is used for disk-based file storage . Records are stored in buckets (1 disk block or a group of blocks). A hash function maps keys to bucket numbers (not direct addresses). A conversion table in the file header maps bucket numbers → block addresses.

Collision Resolution in External Hashing Chaining : Each bucket has a pointer to a linked list of overflow records. Dynamic Hashing : Allows growth in number of buckets as records increase.

Static vs. Dynamic Hashing Static Hashing : Uses a fixed number of buckets ( M ), leading to either wasted space or excessive collisions if record numbers fluctuate. Dynamic Hashing : Adjusts the number of buckets dynamically, reducing the need for frequent reorganizations.