375 views

Uploaded by Ramzi Alqrainy

save

- lesson plan 2 docx
- Patch
- standard2 artefact3
- Lesson Plan Rough Draft
- 10 Hashing
- Kamel Aouiche and Daniel Lemire, Unassuming View-Size Estimation Techniques in OLAP, An Experimental Comparison, Proceedings of ICEIS-2007, pp. 145-150, 2007.
- Rdbms (Unit 2)
- Hashing and Classes
- edtech 506-lesson 1
- RT MAT T2
- Trial8 Ora 4828 Inform View Comments.trc
- Programming Questions Are Integral Part of Any Java or C
- ADDA
- Week 12 Hashing
- What is Enqueue and Locks
- 2017Lesson_April18_24.pdf
- lessonplangroup4-1
- 13
- g8m1l10- operations with scientific notation 3
- How to Master Times Tables
- math lesson - saved
- tyler read 320 lesson plan
- ISUG ASE15 Tech Insight May
- g8m1l10- operations with scientific notation 3
- Tera Data
- review jurnal teori bilangan
- lessonplangroup4
- 3byear8
- g8m1l10- operations with scientific notation 2
- 3 Step Multiplication Trick - A Shortcut Method _ Bank Exams Today
- Pvu Semana II
- COORDENADAS POLARES
- names.docx
- Pyramid_of_thoughts_!_.pdf
- 22..Pelynn RM,metode identifikasi.doc
- lkjhgfdszgh,hgfd
- Aula Química Pedro
- Fotos Chevroletr Chevette
- Toyotismo
- Power Block Cable Installation.docx
- Dokumen.tips Multi Level Marketing 55849bc844b55
- Volume Nes
- Diferenciales y Transmisiones
- Lista de Tragos Festejo
- Ejercicio 3 de Cinematica de Cuerpos Rígidos (Taller Julio 2018)
- Se_dizolva_93_g_de_anilina_intr.doc
- practicas.pdf
- EORMS-ENCY-1.doc
- DISEÑO DE PROGRAMAS Y PROYECTOS DE EDUCACION AMBIENTAL.docx
- manual-electronica-automovil-fundamentos-sensores-actuadores-sistemas-componentes-funcionamiento-1.pdf
- 8th grade ela maap it out 4
- Google_Android_Security_2014_Report_Final.pdf
- Supplemental Filipino High School Grade 8 4rth Q.pdf
- Características Das Cantigas de Amigo
- gova
- Cv Ridho New
- Corrector-de-La-Escala-de-Ansiedad-Infantil-de-Spence.pdf
- 374483240-Kekuatan-Konstruksi-Tower-Untuk-Catwalk-Dan-Chain-Conveyor.pdf
- Drake 2006
- PowerPoint Template Standard.pptx
- النفايات الصلبة و إعادة تدويرها
- Search Behaviour Patterns
- Linked Stacks and Queues
- How to Prevent the Cache Problem in AJAX
- Intel Microprocessor History
- المياه و كيفية الحفاظ عليها
- Advance Data Structure

You are on page 1of 11

qcs_2008@yahoo.com ramzi_cs@hotmail.com

Hashing

Designing hash functions Analysis of Hashing Method

2

3 7

Implementation of Alqrainy`s Function 8

1|Page HASHING

HASHING

A Hash function is any well-defined procedure or mathematical function which converts a large, possibly variable-sized amount of data into a small datum, usually a single integer that may serve as an index into an array. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes.

Hash functions are mostly used to speed up table lookup or data comparison tasks — such as finding items in a database, detecting duplicated or similar records in a large file, finding similar stretches in DNA sequences, and so on.

The basic idea in hashing is to take a field in a record, known as the key, and convert it through some fixed process (Hashing Function) to a numeric value (Hash Value) in the range of 0…m-1 , where m is the table size.

2|Page HASHING

*** Designing hash functions
**

A good has function satisfies the assumption of simple uniform hashing: each key is equally likely to hash to any of the m slots, independently of where any other key has hashed to. * Hashing By Division * Hashing By Multiplication * Hashing By Mid-Square

* The division method The division method involves mapping k into the ith slot where i is the remainder when k is divided by the number of slots, m. That is, the hash function is: h(k) = k mod m With these conventions, let us write a method in C++ to hash the key and returning a

hash value by division method. * This code is a part from "Ramzi Code" in page 7

(*)

3|Page HASHING

*** The multiplication method
**

The multiplication method for creating hash functions operates in two steps. 1.Multiply the key k by a constant A in the range 0 < A < 1 and extract the fractional part of kA. 2. Multiply this value by m and take the floor of the result. In short the hash function is:

* The Mid-Square Method The key K is squared, then the hash function h is defined by: h(k)=L Where L is obtained by deleting digits from both ends of k2

4|Page HASHING

** Alqrainy`s function

In this assignment, I have developed my own function (called "Alqrainy's function") to minimize the collision when using Hashing table. Fig-1 describes Alqrainy's function.

Alqrainy(k)=[k+(hash_size*3)/7] mod hash_size

Fig-1 Where k = key, hash_size = hash table size.

5|Page HASHING

In order to give a picture of number of collision , five experiments have been done using four methods. These methods are (Division, Multiplication,Mid-Sqaure , Alqrainy), the results of the experiments are shown in figure-2

This code to generate the distinct random number.

6|Page HASHING

* Analysis of Hashing Method

**exp5 exp4 exp3 exp2 exp1 0
**

exp1 Alqrainy Mid-Square Multiplication Division 52 68 57 63

Alqrainy Mid-Square Multiplication Division

20

exp2 55 71 62 56

40

exp3 62 65 67 64

60

exp4 65 72 71 65

80

exp5 59 68 58 57

ff Fig-2

As shown in figure 2 the relationship between the Alqrainy's function and the number of the collision has achieved good result a mong other methods

The code of the Alqrainy's function is described below.

7|Page HASHING

Implementation of Alqrainy`s Function in C++

8|Page HASHING

9|Page HASHING

10 | P a g e HASHING

11 | P a g e HASHING

- lesson plan 2 docxUploaded byapi-341229638
- PatchUploaded byLee Kai Quan
- standard2 artefact3Uploaded byapi-220443343
- Lesson Plan Rough DraftUploaded byKaitlyn Leatherman
- 10 HashingUploaded byAshley Jain
- Kamel Aouiche and Daniel Lemire, Unassuming View-Size Estimation Techniques in OLAP, An Experimental Comparison, Proceedings of ICEIS-2007, pp. 145-150, 2007.Uploaded byDaniel Lemire
- Rdbms (Unit 2)Uploaded byshivamtailor
- Hashing and ClassesUploaded byCoursePin
- edtech 506-lesson 1Uploaded byapi-293769922
- RT MAT T2Uploaded byPuvaneswariMunusamy
- Trial8 Ora 4828 Inform View Comments.trcUploaded byManoj Kumar
- Programming Questions Are Integral Part of Any Java or CUploaded bymalliarjun
- ADDAUploaded byAnupam Kumar
- Week 12 HashingUploaded byahmadafaq09
- What is Enqueue and LocksUploaded byJS
- 2017Lesson_April18_24.pdfUploaded byerinconrad
- lessonplangroup4-1Uploaded byapi-272895965
- 13Uploaded byqwertr707936
- g8m1l10- operations with scientific notation 3Uploaded byapi-276774049
- How to Master Times TablesUploaded byrajivberi11
- math lesson - savedUploaded byapi-334274679
- tyler read 320 lesson planUploaded byapi-349577905
- ISUG ASE15 Tech Insight MayUploaded bytouch_vicky
- g8m1l10- operations with scientific notation 3Uploaded byapi-276774049
- Tera DataUploaded byNaresh Mundra
- review jurnal teori bilanganUploaded bynur jannah
- lessonplangroup4Uploaded byapi-270729527
- 3byear8Uploaded byStanley
- g8m1l10- operations with scientific notation 2Uploaded byapi-276774049
- 3 Step Multiplication Trick - A Shortcut Method _ Bank Exams TodayUploaded byVivek Sen Gupta

- النفايات الصلبة و إعادة تدويرهاUploaded byRamzi Alqrainy
- Search Behaviour PatternsUploaded byRamzi Alqrainy
- Linked Stacks and QueuesUploaded byRamzi Alqrainy
- How to Prevent the Cache Problem in AJAXUploaded byRamzi Alqrainy
- Intel Microprocessor HistoryUploaded byRamzi Alqrainy
- المياه و كيفية الحفاظ عليهاUploaded byRamzi Alqrainy
- Advance Data StructureUploaded byRamzi Alqrainy