{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lecture5 - Lecture 5 The Hash Function Daniel Frances c...

This preview shows pages 1–3. Sign up to view the full content.

Lecture 5: The Hash Function Daniel Frances c 2012 Contents 1 Hash functions 2 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1 Hash functions Suppose a company needs to store, and randomly access 100,000 Visa card numbers. Each visa number is a 16 digit code. How much storage is required? To randomly access each number we would need an array large enough to accommodate all possible 10 17 - 1 10 17 entries. Even if we stored 1 byte in each entry of the array we would need 10 17 bytes = 10 14 Kbytes = 10 11 Mb = 10 8 Gb. A lot of storage! The basis for the idea of a hash function is that of all possible 10 17 numbers we are only using 100,000 numbers, a very small percentage of the array. To be precise 10 5 10 - 17 10 2 = 10 - 10 percent of the entries! Perhaps we could manage with a much smaller array, say of 100,000 numbers, if we could somehow minimize the chances of storing more than one Visa number in the same location of the smaller array. We don’t have to rule out the possibility that more than one Visa number will refer to the same location of the smaller array. If that were to happen, i.e. if we
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

lecture5 - Lecture 5 The Hash Function Daniel Frances c...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online