Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary hashing techniques in C

Rating
-
Sold
-
Pages
7
Uploaded on
26-02-2023
Written in
2022/2023

easy to understand and in short about the topics last moment revision notes for exam

Institution
Course

Content preview

Hashing
Hashing can be used to build, search, or delete from a table.

The basic idea behind hashing is to take a field in a record, known as the key, and
convert it through some fixed process to a numeric value, known as the hash key,
which represents the position to either store or find an item in the table.

The numeric value will be in the range of 0 to n-1, where n is the maximum
number of slots (or buckets) in the table.

The fixed process to convert a key to a hash key is known as a hash function. This
function will be used whenever access to the table is needed.




One common method of determining a hash key is the division method of
hashing. The formula that will be used is:

hash key = key % number of slots in the table

, The division method is generally a reasonable strategy, unless the key happens to
have some undesirable properties. For example, if the table size is 10 and all of the
keys end in zero.

In this case, the choice of hash function and table size needs to be carefully
considered. The best table sizes are prime numbers.

One problem though is that keys are not always numeric. In fact, it's common for
them to be strings.

One possible solution: add up the ASCII values of the characters in the string to get
a numeric value and then perform the division method.

No matter what the hash function, there is the possibility that two keys could
resolve to the same hash key. This situation is known as a collision.

When this occurs, there are two simple solutions:

1. chaining
2. linear probe (aka linear open addressing)

And two slightly more difficult solutions

3. Quadratic Probe
4. Double Hashing

Written for

Institution
Course

Document information

Uploaded on
February 26, 2023
Number of pages
7
Written in
2022/2023
Type
SUMMARY

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
yashonandan9480

Get to know the seller

Seller avatar
yashonandan9480 bengaluru city university
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions