1 / 11

Hashed Files Text Versus Binary

Hashed Files Text Versus Binary. Meghan Cavanagh. Hashed Files a file that is searched using one of the hashing methods. User gives the key, the function maps the key to the address and passes it to the operating system then the record is retrieved. Hashing Methods. Direct Hashing

Download Presentation

Hashed Files Text Versus Binary

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hashed Files Text Versus Binary Meghan Cavanagh

  2. Hashed Filesa file that is searched using one of the hashing methods User gives the key, the function maps the key to the address and passes it to the operating system then the record is retrieved

  3. Hashing Methods • Direct Hashing • Modulo Division • Digit Extraction • Mid-square • Folding • Rotational • Pseudorandom

  4. Direct Hashing Methodthe key is obtained without any algorithmic manipulation • Contains a record for every possible key • Limited situations for this method • Very powerful because it guarantees that there are no synonyms or collisions

  5. Modulo Division Method(division remainder hashing) divides the key by the file size and uses the remainder plus one for the address • Algorithm works with any list size but a prime number produces fewer collisions than other list sizes • The list size in the equation below is the number of elements in the file

  6. Digit Extraction Methodselected digits are extracted from the key and used as the address For example if you use a six digit employee number to hash to a three digit address you could select the first, third and fourth digits and use them as the address

  7. Collisionoccurs when a hashing algorithm produces an address for an insertion and that address is already occupiedSynonymstwo or more keys the hatch to the same home addressHome Addressthe first address produced by the hashing algorithmPrime Areathe memory that contains the home address

  8. Collision Resolution • Open Addressing Resolution-when a collision occurs, the prime area addresses are searched for an opened or unoccupied record where the new data can be placed • Linked List Resolution-eliminates the probability of future collisions where the first record is stored in the home address, but it contains a pointer to the second record • Bucket Hashing-uses a location that can accommodate multiple data units to reduce collision • Combination Approaching-uses several approaches to resolve the collision

  9. Text File • File of characters • Cannot contain integers, floating point numbers or any other data structures in their internal memory format • In order to store these data types they must be converted to their character equivalent formats • The most well known text files are file streams for key boards, monitors and printers

  10. Binary Files • Collection of data stored in the internal format of the computer • Data can be an integer, a floating point number, a character or any other structured data (except a file) • Contains data that is meaningful only if they are properly interpreted by the program

  11. The End

More Related