Hashed Files Text Versus Binary - PowerPoint PPT Presentation

About This Presentation
Title:

Hashed Files Text Versus Binary

Description:

Hashed Files. Text Versus Binary. Meghan Cavanagh. Hashed Files. a file that is searched using one ... User gives the key, the function maps the key to the ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 12
Provided by: mecav
Learn more at: http://www.cs.loyola.edu
Category:
Tags: binary | files | hashed | meghan | text | versus

less

Transcript and Presenter's Notes

Title: Hashed Files Text Versus Binary


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
Write a Comment
User Comments (0)
About PowerShow.com