SlideShare a Scribd company logo
1 of 24
Download to read offline
Introduction Hashing Techniques Applications
HASHING
Muhammad Adil Raja
Introduction Hashing Techniques Applications
OUTLINE
1 INTRODUCTION
2 HASHING TECHNIQUES
3 APPLICATIONS
Introduction Hashing Techniques Applications
OUTLINE
1 INTRODUCTION
2 HASHING TECHNIQUES
3 APPLICATIONS
Introduction Hashing Techniques Applications
OUTLINE
1 INTRODUCTION
2 HASHING TECHNIQUES
3 APPLICATIONS
Introduction Hashing Techniques Applications
HASHING
The idea of hashing is to distribute the entries of a dataset
across an array of buckets.
Given a key, the algorithm computes an index that
suggests where an entry can be found:
index = f(key, array_size)
Often this is done in two steps:
hash = hashfunc(key).
index = hash % array_size
Introduction Hashing Techniques Applications
WHAT IS HASHING
A Hash Table
A data structure to implement an associative array.
A structure that can map keys to values.
Uses a hash function to compute an index into an array of
buckets or slots from which the correct value can be found.
Introduction Hashing Techniques Applications
HASHING TECHNIQUES
Separate Chaining.
Open Addressing.
Coalesced Hashing.
....
Introduction Hashing Techniques Applications
HASH FUNCTION
Crucial for good hash table performance.
Can be difficult to achieve.
A basic expectation is that the function would provide a
uniform distribution of hash values.
A non-uniform distribution increases the number of
collisions and the cost of resolving them.
Introduction Hashing Techniques Applications
COLLISION RESOLUTION
Practically unavoidable.
Birthday problem.
Introduction Hashing Techniques Applications
SEPARATE CHAINING
Every bucket is independent.
And maintains a list of entries with the same index.
Time for hash function operations depends on the time to
find the bucket (constant) and the time for list operations.
The technique is also called open hashing or closed
addressing.
In a good hash table every bucket has very few entries.
Introduction Hashing Techniques Applications
SEPARATE CHAINING
FIGURE: Pause
Introduction Hashing Techniques Applications
SEPARATE CHAINING WITH LINKED LISTS
Popular as they require basic data structures with simple
algorithms.
They can use simple hash functions that are unsuitable for
other methods.
Cost of the table operation depends on the size of the
selected bucket for the desired key.
The worst case scenario is when all the entries are
inserted into the same bucket.
Introduction Hashing Techniques Applications
SEPARATE CHAINING WITH OTHER DATA STRUCTURES
AVL Trees.
BSTs.
Dynamic Arrays.
Introduction Hashing Techniques Applications
TIME COMPLEXITY MEASURES
TABLE: Time Complexity Measures
Guarantee Average Case
Implementation Search Insert Delete Search Insert Delete
Unordered Array N N N N/2 N/2 N/2
Ordered Array lg N N N lg N N/2 N/2
Unordered List N N N N/2 N N/2
Ordered List N N N N/2 N/2 N/2
BST N N N 1.39 lg N 1.39 lg N ?
Randomized BST 7 lg N 7 lg N 7 lg N 1.39 lg N 1.39 lg N 1.39 lg N
Introduction Hashing Techniques Applications
OPEN ADDRESSING (CLOSED HASHING)
All entry records are stored in the bucket array itself.
Insertion of a new entry: The buckets are examined,
starting from the hashed-to slot and proceeding in some
probe sequence, until an unoccupied slot is found.
Searching: The buckets are scanned in the same
sequence, until the target entry is found, or an unused slot
is found, which indicates that there is no such key in the
table.
Open Addressing: Refers to the fact that location (address)
of an entry is not determined by its hash value.
Closed Hashing: Not to be confused with open hashing or
close addressing -> names reserved for separate chaining.
Introduction Hashing Techniques Applications
PROBE SEQUENCES
Linear Probing – A fixed interval between probes (usually
1).
Quadratic Probing – Interval between probes is increased
by adding the successive outputs of a quadratic polynomial
to the starting value given by the original computation.
Double Hashing – Interval between probes is computed by
another hash function.
Drawback: The number of stored entries cannot exceed
the number of slots in the bucket array.
Introduction Hashing Techniques Applications
OPEN ADDRESSING
Introduction Hashing Techniques Applications
LOAD FACTOR – A KEY STATISTIC
Number of entries divided by the number of buckets – n/k.
If this grows too large the hash table becomes slow.
Variance of number of entires per bucket is important.
Two tables have 1000 entries and 1000 buckets.
One has one entry in one bucket and the second has all
the entries in one bucket.
Hashing is not working in the second hash table.
A low load factor is not beneficial.
As the load factor approaches 0, the proportion of unused
areas in the hash table increases.
This does not necessarily reduce the search cost.
This results in wasted memory.
Introduction Hashing Techniques Applications
HOW DROPBOX KNOWS YOU ARE SHARING
COPYRIGHTED STUFF
Dropbox checks the hash of a shared file against a banned
list, and blocks the share if there is a match.
With a properly implemented hash function, running the
same exact file through the algorithm twice will return the
same identifier both times – but changing a file even
slightly completely changes the hash.
This identifier can be used to tell you if a file is exactly the
same as another file – but it is a one way street.
The hash couldn’t tell you what that original file is, without
you already knowing or having a copy of the file to
compare it to.
Introduction Hashing Techniques Applications
DROPBOX
FIGURE: Pause
Introduction Hashing Techniques Applications
DROPBOX
When you upload a file to Dropbox, two things happen to it:
a hash is generated, and then the file gets encrypted to
keep any unauthorized user (be it a hacker or a Dropbox
employee) who somehow stumbles it sitting on Dropbox’s
servers from easily being able to open it up.
After a DMCA complaint is verified by Dropbox’s legal
team, Dropbox adds that file’s hash to a big blacklist of
hashes known to be those corresponding to files they can’t
legally allow to be shared. When you share a link to a file,
it checks that file’s hash against the blacklist.
If the file you are sharing is the exact same file that a
copyright holder complained about, it is blocked from being
shared with others. If it is something else – a new file, or
even a modified version of the same file – a hash-based
anti-infringement system should not have any idea what it
is looking at.
Introduction Hashing Techniques Applications
SUBTREE CACHING (IN SYMBOLIC REGRESSION)
log
log
tan z
+
y
x * (tan y + z ) log (x + yz )
*
x +
*
x *
y z
parents
Functions
subtrees selected randomly for crossover
Introduction Hashing Techniques Applications
SUBTREE CACHING
Every subtree is evaluated and cached, along with its
evaluation.
As a new tree arrives, its subtrees are supposed to be
evaluated recursively.
Before evaluation, the cache is checked for an evaluation
of a matching subtree.
If found, evaluation is kept. If not found, the new subtree is
evaluated and its evaluation is stored in the cache.
Improves performance by saving time on unnecessary
evaluations.
Introduction Hashing Techniques Applications
THANKYOU

More Related Content

What's hot

Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructurerajshreemuthiah
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
Data structure tries
Data structure triesData structure tries
Data structure triesMd. Naim khan
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms HashingManishPrajapati78
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]Muhammad Hammad Waseem
 
Hash table
Hash tableHash table
Hash tableVu Tran
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)Home
 
Indexing and Hashing
Indexing and HashingIndexing and Hashing
Indexing and Hashingsathish sak
 
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...NaveenPeter8
 

What's hot (20)

Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructure
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Hash tables
Hash tablesHash tables
Hash tables
 
Data structure tries
Data structure triesData structure tries
Data structure tries
 
Run time storage
Run time storageRun time storage
Run time storage
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms Hashing
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Hashing
HashingHashing
Hashing
 
Hash table
Hash tableHash table
Hash table
 
Ch17 Hashing
Ch17 HashingCh17 Hashing
Ch17 Hashing
 
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
 
linear probing
linear probinglinear probing
linear probing
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Hashing
HashingHashing
Hashing
 
Indexing and Hashing
Indexing and HashingIndexing and Hashing
Indexing and Hashing
 
Searching algorithms
Searching algorithmsSearching algorithms
Searching algorithms
 
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
 
Indexing Data Structure
Indexing Data StructureIndexing Data Structure
Indexing Data Structure
 
File organization
File organizationFile organization
File organization
 
08 Hash Tables
08 Hash Tables08 Hash Tables
08 Hash Tables
 

Viewers also liked

Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...cprogrammings
 
The Physical Layer
The Physical LayerThe Physical Layer
The Physical Layeradil raja
 
Classes And Methods
Classes And MethodsClasses And Methods
Classes And Methodsadil raja
 
Data structure and algorithms in c++
Data structure and algorithms in c++Data structure and algorithms in c++
Data structure and algorithms in c++Karmjeet Chahal
 
The Data Link Layer
The Data Link LayerThe Data Link Layer
The Data Link Layeradil raja
 
Polymorphism and Software Reuse
Polymorphism and Software ReusePolymorphism and Software Reuse
Polymorphism and Software Reuseadil raja
 
Universal Declarative Services
Universal Declarative ServicesUniversal Declarative Services
Universal Declarative Servicesschemouil
 
12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-studentrandhirlpu
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
 
XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsNicolas Demengel
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismJussi Pohjolainen
 
The Network Layer
The Network LayerThe Network Layer
The Network Layeradil raja
 

Viewers also liked (20)

Association agggregation and composition
Association agggregation and compositionAssociation agggregation and composition
Association agggregation and composition
 
04 design concepts_n_principles
04 design concepts_n_principles04 design concepts_n_principles
04 design concepts_n_principles
 
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
 
The Physical Layer
The Physical LayerThe Physical Layer
The Physical Layer
 
Classes And Methods
Classes And MethodsClasses And Methods
Classes And Methods
 
Data structure and algorithms in c++
Data structure and algorithms in c++Data structure and algorithms in c++
Data structure and algorithms in c++
 
The Data Link Layer
The Data Link LayerThe Data Link Layer
The Data Link Layer
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
Polymorphism and Software Reuse
Polymorphism and Software ReusePolymorphism and Software Reuse
Polymorphism and Software Reuse
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Universal Declarative Services
Universal Declarative ServicesUniversal Declarative Services
Universal Declarative Services
 
12 couplingand cohesion-student
12 couplingand cohesion-student12 couplingand cohesion-student
12 couplingand cohesion-student
 
Syntax part 6
Syntax part 6Syntax part 6
Syntax part 6
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 
XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & Constructs
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
WSO2 Complex Event Processor
WSO2 Complex Event ProcessorWSO2 Complex Event Processor
WSO2 Complex Event Processor
 
Cohesion and coherence
Cohesion and coherenceCohesion and coherence
Cohesion and coherence
 
Cohesion & Coupling
Cohesion & Coupling Cohesion & Coupling
Cohesion & Coupling
 
The Network Layer
The Network LayerThe Network Layer
The Network Layer
 

Similar to Hashing and Hash Tables

unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxBabaShaikh3
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structureMahmoud Alfarra
 
introduction to trees,graphs,hashing
introduction to trees,graphs,hashingintroduction to trees,graphs,hashing
introduction to trees,graphs,hashingAkhil Prem
 
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...DECK36
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing TablesChinmaya M. N
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptxAgonySingh
 
Data Step Hash Object vs SQL Join
Data Step Hash Object vs SQL JoinData Step Hash Object vs SQL Join
Data Step Hash Object vs SQL JoinGeoff Ness
 
Distributed Caching - Cache Unleashed
Distributed Caching - Cache UnleashedDistributed Caching - Cache Unleashed
Distributed Caching - Cache UnleashedAvishek Patra
 
Ts project Hash based inventory system
Ts project Hash based inventory systemTs project Hash based inventory system
Ts project Hash based inventory systemDADITIRUMALATARUN
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptxskilljiolms
 
Bloom Filters: An Introduction
Bloom Filters: An IntroductionBloom Filters: An Introduction
Bloom Filters: An IntroductionIRJET Journal
 
Hive query optimization infinity
Hive query optimization infinityHive query optimization infinity
Hive query optimization infinityShashwat Shriparv
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniyaTutorialsDuniya.com
 
Experimenting With Big Data
Experimenting With Big DataExperimenting With Big Data
Experimenting With Big DataNick Boucart
 
Hash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxHash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxmy6305874
 

Similar to Hashing and Hash Tables (20)

unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
 
asdfew.pptx
asdfew.pptxasdfew.pptx
asdfew.pptx
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
 
Hashing
HashingHashing
Hashing
 
introduction to trees,graphs,hashing
introduction to trees,graphs,hashingintroduction to trees,graphs,hashing
introduction to trees,graphs,hashing
 
Ds 8
Ds 8Ds 8
Ds 8
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
 
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...
Real-time Data De-duplication using Locality-sensitive Hashing powered by Sto...
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing Tables
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptx
 
Data Step Hash Object vs SQL Join
Data Step Hash Object vs SQL JoinData Step Hash Object vs SQL Join
Data Step Hash Object vs SQL Join
 
Distributed Caching - Cache Unleashed
Distributed Caching - Cache UnleashedDistributed Caching - Cache Unleashed
Distributed Caching - Cache Unleashed
 
Ts project Hash based inventory system
Ts project Hash based inventory systemTs project Hash based inventory system
Ts project Hash based inventory system
 
Hash pre
Hash preHash pre
Hash pre
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptx
 
Bloom Filters: An Introduction
Bloom Filters: An IntroductionBloom Filters: An Introduction
Bloom Filters: An Introduction
 
Hive query optimization infinity
Hive query optimization infinityHive query optimization infinity
Hive query optimization infinity
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniya
 
Experimenting With Big Data
Experimenting With Big DataExperimenting With Big Data
Experimenting With Big Data
 
Hash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptxHash in datastructures by using the c language.pptx
Hash in datastructures by using the c language.pptx
 

More from adil raja

A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specificationadil raja
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehiclesadil raja
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystifiedadil raja
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)adil raja
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Researchadil raja
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocoladil raja
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Socketsadil raja
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Executionadil raja
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistanadil raja
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousingadil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...adil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...adil raja
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPadil raja
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specificationsadil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...adil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...adil raja
 

More from adil raja (20)

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdf
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specification
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Research
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocol
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Sockets
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Execution
 
Thesis
ThesisThesis
Thesis
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistan
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
 
VoIP
VoIPVoIP
VoIP
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specifications
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 
ULMAN-GUI
ULMAN-GUIULMAN-GUI
ULMAN-GUI
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 

Recently uploaded (20)

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 

Hashing and Hash Tables

  • 1. Introduction Hashing Techniques Applications HASHING Muhammad Adil Raja
  • 2. Introduction Hashing Techniques Applications OUTLINE 1 INTRODUCTION 2 HASHING TECHNIQUES 3 APPLICATIONS
  • 3. Introduction Hashing Techniques Applications OUTLINE 1 INTRODUCTION 2 HASHING TECHNIQUES 3 APPLICATIONS
  • 4. Introduction Hashing Techniques Applications OUTLINE 1 INTRODUCTION 2 HASHING TECHNIQUES 3 APPLICATIONS
  • 5. Introduction Hashing Techniques Applications HASHING The idea of hashing is to distribute the entries of a dataset across an array of buckets. Given a key, the algorithm computes an index that suggests where an entry can be found: index = f(key, array_size) Often this is done in two steps: hash = hashfunc(key). index = hash % array_size
  • 6. Introduction Hashing Techniques Applications WHAT IS HASHING A Hash Table A data structure to implement an associative array. A structure that can map keys to values. Uses a hash function to compute an index into an array of buckets or slots from which the correct value can be found.
  • 7. Introduction Hashing Techniques Applications HASHING TECHNIQUES Separate Chaining. Open Addressing. Coalesced Hashing. ....
  • 8. Introduction Hashing Techniques Applications HASH FUNCTION Crucial for good hash table performance. Can be difficult to achieve. A basic expectation is that the function would provide a uniform distribution of hash values. A non-uniform distribution increases the number of collisions and the cost of resolving them.
  • 9. Introduction Hashing Techniques Applications COLLISION RESOLUTION Practically unavoidable. Birthday problem.
  • 10. Introduction Hashing Techniques Applications SEPARATE CHAINING Every bucket is independent. And maintains a list of entries with the same index. Time for hash function operations depends on the time to find the bucket (constant) and the time for list operations. The technique is also called open hashing or closed addressing. In a good hash table every bucket has very few entries.
  • 11. Introduction Hashing Techniques Applications SEPARATE CHAINING FIGURE: Pause
  • 12. Introduction Hashing Techniques Applications SEPARATE CHAINING WITH LINKED LISTS Popular as they require basic data structures with simple algorithms. They can use simple hash functions that are unsuitable for other methods. Cost of the table operation depends on the size of the selected bucket for the desired key. The worst case scenario is when all the entries are inserted into the same bucket.
  • 13. Introduction Hashing Techniques Applications SEPARATE CHAINING WITH OTHER DATA STRUCTURES AVL Trees. BSTs. Dynamic Arrays.
  • 14. Introduction Hashing Techniques Applications TIME COMPLEXITY MEASURES TABLE: Time Complexity Measures Guarantee Average Case Implementation Search Insert Delete Search Insert Delete Unordered Array N N N N/2 N/2 N/2 Ordered Array lg N N N lg N N/2 N/2 Unordered List N N N N/2 N N/2 Ordered List N N N N/2 N/2 N/2 BST N N N 1.39 lg N 1.39 lg N ? Randomized BST 7 lg N 7 lg N 7 lg N 1.39 lg N 1.39 lg N 1.39 lg N
  • 15. Introduction Hashing Techniques Applications OPEN ADDRESSING (CLOSED HASHING) All entry records are stored in the bucket array itself. Insertion of a new entry: The buckets are examined, starting from the hashed-to slot and proceeding in some probe sequence, until an unoccupied slot is found. Searching: The buckets are scanned in the same sequence, until the target entry is found, or an unused slot is found, which indicates that there is no such key in the table. Open Addressing: Refers to the fact that location (address) of an entry is not determined by its hash value. Closed Hashing: Not to be confused with open hashing or close addressing -> names reserved for separate chaining.
  • 16. Introduction Hashing Techniques Applications PROBE SEQUENCES Linear Probing – A fixed interval between probes (usually 1). Quadratic Probing – Interval between probes is increased by adding the successive outputs of a quadratic polynomial to the starting value given by the original computation. Double Hashing – Interval between probes is computed by another hash function. Drawback: The number of stored entries cannot exceed the number of slots in the bucket array.
  • 17. Introduction Hashing Techniques Applications OPEN ADDRESSING
  • 18. Introduction Hashing Techniques Applications LOAD FACTOR – A KEY STATISTIC Number of entries divided by the number of buckets – n/k. If this grows too large the hash table becomes slow. Variance of number of entires per bucket is important. Two tables have 1000 entries and 1000 buckets. One has one entry in one bucket and the second has all the entries in one bucket. Hashing is not working in the second hash table. A low load factor is not beneficial. As the load factor approaches 0, the proportion of unused areas in the hash table increases. This does not necessarily reduce the search cost. This results in wasted memory.
  • 19. Introduction Hashing Techniques Applications HOW DROPBOX KNOWS YOU ARE SHARING COPYRIGHTED STUFF Dropbox checks the hash of a shared file against a banned list, and blocks the share if there is a match. With a properly implemented hash function, running the same exact file through the algorithm twice will return the same identifier both times – but changing a file even slightly completely changes the hash. This identifier can be used to tell you if a file is exactly the same as another file – but it is a one way street. The hash couldn’t tell you what that original file is, without you already knowing or having a copy of the file to compare it to.
  • 20. Introduction Hashing Techniques Applications DROPBOX FIGURE: Pause
  • 21. Introduction Hashing Techniques Applications DROPBOX When you upload a file to Dropbox, two things happen to it: a hash is generated, and then the file gets encrypted to keep any unauthorized user (be it a hacker or a Dropbox employee) who somehow stumbles it sitting on Dropbox’s servers from easily being able to open it up. After a DMCA complaint is verified by Dropbox’s legal team, Dropbox adds that file’s hash to a big blacklist of hashes known to be those corresponding to files they can’t legally allow to be shared. When you share a link to a file, it checks that file’s hash against the blacklist. If the file you are sharing is the exact same file that a copyright holder complained about, it is blocked from being shared with others. If it is something else – a new file, or even a modified version of the same file – a hash-based anti-infringement system should not have any idea what it is looking at.
  • 22. Introduction Hashing Techniques Applications SUBTREE CACHING (IN SYMBOLIC REGRESSION) log log tan z + y x * (tan y + z ) log (x + yz ) * x + * x * y z parents Functions subtrees selected randomly for crossover
  • 23. Introduction Hashing Techniques Applications SUBTREE CACHING Every subtree is evaluated and cached, along with its evaluation. As a new tree arrives, its subtrees are supposed to be evaluated recursively. Before evaluation, the cache is checked for an evaluation of a matching subtree. If found, evaluation is kept. If not found, the new subtree is evaluated and its evaluation is stored in the cache. Improves performance by saving time on unnecessary evaluations.
  • 24. Introduction Hashing Techniques Applications THANKYOU