Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understand the Hashing, Slides of Computer Programming

Hashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function that enables fast retrieval of information based on its key.

Typology: Slides

2020/2021

Available from 02/02/2025

the-manku-store
the-manku-store 🇮🇳

8 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Hashing
pf3
pf4

Partial preview of the text

Download Understand the Hashing and more Slides Computer Programming in PDF only on Docsity!

Hashing

Hash function H(x) maps the value x at the index x%10 in an Array.

Hashing

Search Operation

struct DataItem *search(int key) { //get the hash int hashIndex = hashCode(key); if(hashArray[hashIndex]->key == key) return hashArray[hashIndex]; return NULL; }

Insert Operation

void insert(int key,int data) { struct DataItem item = (struct DataItem) malloc(sizeof(struct DataItem)); item->data = data; item->key = key; //get the hash int hashIndex = hashCode(key); hashArray[hashIndex] = item; }