0% found this document useful (0 votes)
11 views2 pages

Keystone School of Engineering: Group A Assignment - 2

The document outlines an assignment for implementing a dictionary using hashing techniques, focusing on operations such as insert, find, and delete for key-value pairs. It discusses the importance of hash functions, hash tables, and collision handling methods like chaining and open addressing. The objective is to understand and apply hashing concepts in a practical programming environment using C++ on a Linux system.

Uploaded by

AYAAN TAMBOLI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Keystone School of Engineering: Group A Assignment - 2

The document outlines an assignment for implementing a dictionary using hashing techniques, focusing on operations such as insert, find, and delete for key-value pairs. It discusses the importance of hash functions, hash tables, and collision handling methods like chaining and open addressing. The objective is to understand and apply hashing concepts in a practical programming environment using C++ on a Linux system.

Uploaded by

AYAAN TAMBOLI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Shalaka Foundation’s

KEYSTONE SCHOOL OF ENGINEERING


DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

Group A Assignment - 2

Problem Statement: Implement all the functions of a dictionary (ADT) using hashing. Data: Set of
(key, value) pairs, Keys are mapped to values, Keys must be comparable, Keys must be
unique Standard operations: Insert (key, value), Find (key), Delete (key).

Objective: To understand the concept and basic of Hashing Technique in Data structure.

Outcome: To implement the concept and basic of Hash function, and hashing technique to perform
insert, search and delete operation in Hash table.

Software & Hardware Requirements:

1. 64-bit Open-source Linux or its derivative

2. Open Source C++ Programming tool like G++/GCC

Theory Concepts:

We know that a list was ordered, we could search in logarithmic time using a binary search. With
balanced binary search tree, All of these operations search, insert and delete times can be
guaranteed to be in O(Logn) time. Another solution for this operation is use of direct access table,
in this program we build a data structure that can be searched in O(1) time. This concept is referred
to as hashing.

Hashing is an improvement over Direct Access Table. The idea is to use hash function that converts
a given phone number or any other key to a smaller number and uses the small number as index in a
table called hash table.

Hash Function: A function that converts a given big phone number to a small practical integer
value. The mapped integer value is used as an index in hash table. In simple terms, a hash function
maps a big number or string to a small integer that can be used as index in hash table.

A good hash function should have following properties

1) Efficiently computable.

2) Should uniformly distribute the keys (Each table position equally likely for each key)

Hash Table: An array that stores pointers to records corresponding to a given phone number. An

4
Shalaka Foundation’s
KEYSTONE SCHOOL OF ENGINEERING
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

entry in hash table is NIL if no existing phone number has hash function value equal to the index for
the entry.
Collision Handling:

Since a hash function gets us a small number for a big key, there is possibility that two keys
result in same value. The situation where a newly inserted key maps to an already occupied slot in
hash table is called collision and must be handled using some collision handling technique.

Following are the ways to handle collisions:

 Chaining: The idea is to make each cell of hash table point to a linked list of records that have
same hash function value. Chaining is simple, but requires additional memory outside the table.

 Open Addressing: In open addressing, all elements are stored in the hash table itself. Each table
entry contains either a record or NIL. When searching for an element, we one by one examine table
slots until the desired element is found or it is clear that the element is not in the table.

Following are the some Hash Function:

1. Division Modulo

2. Mid Square method

3. Digit Analysis Method

4. Folding Method

5. Extract Min Method Etc.

Following are the Collision Resolution Method

–Linear Probing

-Quadratic Probing

-Double Hashing

Conclusion: Able to implement the hash function and the basic operation such as insert, delete and
search in Hash table.

You might also like