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 (20)

Heap sort
Heap sortHeap sort
Heap sort
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 
Selection sort
Selection sortSelection sort
Selection sort
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Hashing PPT
Hashing PPTHashing PPT
Hashing PPT
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Linked list
Linked listLinked list
Linked list
 
Data Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and ConquerData Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and Conquer
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
 
Heaps
HeapsHeaps
Heaps
 
Hash table
Hash tableHash table
Hash table
 
Red black tree
Red black treeRed black tree
Red black tree
 
single linked list
single linked listsingle linked list
single linked list
 
Bottom up parser
Bottom up parserBottom up parser
Bottom up parser
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
 

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
 
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
 
linear probing
linear probinglinear probing
linear probing
 
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

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
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
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
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
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
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
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
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 

Recently uploaded (20)

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
 
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
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
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...
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
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...
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
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
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 

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