SlideShare a Scribd company logo
1 of 10
Hashing in
Data Structures
Introduction
Hashing:
Hashing is a technique that is used to uniquely identify a specific object
from a group of similar objects. A searching technique based on the hash table and
hash function.
Example:
 In universities, each student is assigned a unique roll number that can be used
to retrieve information about them.
 In libraries, each book is assigned a unique number that can be used to
determine information about the book, such as its exact position in the library
or the users it has been issued to etc.
Hash Function:
A hash function is any function that can be used to map data
of arbitrary size to fixed-size values. The values returned by a hash function are
called hash values, digests.
Or
A function that converts a given big value to a small practical
integer value. Which contain the address of given data.
Hash Key or Simple Key:
A unique assigned value to large number of
objects or a single object.
Working or Example:
 Assume that you have an object and you want
to assign a key to it to make searching easy. To store the key/value pair, you
can use a simple array like a data structure where keys (integers) can be used
directly as an index to store values. However, in cases where the keys are large
and cannot be used directly as an index, you should use hashing.
 In hashing, large keys are converted into small keys by using hash functions.
 The values are then stored in a data structure called hash table.
Implementation of hashing:
Hashing is easily implemented in two
steps:
1. An element is converted into an integer by using a hash function.
2. The element is stored in the hash table where it can be quickly retrieved using
hashed key
hashing=h(k)=adrees
Data Key Address
H(k)
Collision:
Since a hash function gets us a small number for a big key, there
is possibility that two keys result in same value. The situation where a newly
inserted key maps to an already occupied slot in hash table is called collision.
Data 2-Keys Address
Direct Hashing:
A simple hashing technique having no collision or
having only 1 key value. It is not suit able for larger key values.
H(k)
Memory Management:
Def:
Memory management is the process of controlling and coordinating
computer memory, assigning portions called blocks to various running programs
to optimize overall system performance. Memory management resides in
hardware, in the OS (operating system), and in programs and applications.
Garbage Collection:
Garbage collection (computer science) ... In computer
science, garbage collection (GC) is a form of automatic memory management.
The garbage collector, or just collector, attempts to reclaim garbage, or memory
occupied by objects that are no longer in use by the program.
Strengths of Manual Management:
● Comparatively easy to implement.
● “Just” need a working memory manager.
● Allows programmers to make aggressive performance optimizations.
● Programmer can choose allocation scheme that achieves best performance
Automatic Memory Management
● Idea: Have the runtime environment automatically reclaim memory.
● Objects that won't be used again are called garbage.
● Reclaiming garbage objects automatically is called garbage collection.
Advantages:
● Programmer doesn't have to reclaim unused resources.
Disadvantages:
● Programmer can't reclaim unused resources.
What is Garbage?
● An object is called garbage at some point during execution if it will never be
used again
Approximating Garbage
● In general, it is undecidable whether an object is garbage.
● Need to rely on a conservative approximation.
● An object is reachable if it can still be referenced by the program.
● Goal for today: detect and reclaim unreachable objects.
● This does not prevent memory leaks!
● Many reachable objects are never used again.
● It is very easy to have memory leaks in garbage collected languages.
Types of Garbage Collectors
● Incremental vs stop-the-world:
● An incremental collector is one that runs concurrently with the program
● A stop-the-world collector pauses program execution to look for garbage.
● Which is (generally) more precise?
● Which would you use in a nuclear reactor control system

More Related Content

Similar to Hashing.pptx

computer architecture and organization.pptx
computer architecture and organization.pptxcomputer architecture and organization.pptx
computer architecture and organization.pptxROHANSharma311906
 
Hadoop live online training
Hadoop live online trainingHadoop live online training
Hadoop live online trainingHarika583
 
Hadoop online-training
Hadoop online-trainingHadoop online-training
Hadoop online-trainingGeohedrick
 
Vipul divyanshu mahout_documentation
Vipul divyanshu mahout_documentationVipul divyanshu mahout_documentation
Vipul divyanshu mahout_documentationVipul Divyanshu
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
Big Data Analytics With Hadoop
Big Data Analytics With HadoopBig Data Analytics With Hadoop
Big Data Analytics With HadoopUmair Shafique
 
Big data & Hadoop
Big data & HadoopBig data & Hadoop
Big data & HadoopAhmed Gamil
 
Learn what is Hadoop-and-BigData
Learn  what is Hadoop-and-BigDataLearn  what is Hadoop-and-BigData
Learn what is Hadoop-and-BigDataThanusha154
 
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfRGPV De Bunkers
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...Javed Khan
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
Performance Analysis of Hashing Mathods on the Employment of App
Performance Analysis of Hashing Mathods on the Employment of App Performance Analysis of Hashing Mathods on the Employment of App
Performance Analysis of Hashing Mathods on the Employment of App IJECEIAES
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management Shashank Asthana
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing TablesChinmaya M. N
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptxskilljiolms
 
Best Data Mining Techniques You Should Know About!
Best Data Mining Techniques You Should Know About!Best Data Mining Techniques You Should Know About!
Best Data Mining Techniques You Should Know About!Kavika Roy
 

Similar to Hashing.pptx (20)

computer architecture and organization.pptx
computer architecture and organization.pptxcomputer architecture and organization.pptx
computer architecture and organization.pptx
 
Hadoop live online training
Hadoop live online trainingHadoop live online training
Hadoop live online training
 
Hadoop online-training
Hadoop online-trainingHadoop online-training
Hadoop online-training
 
Vipul divyanshu mahout_documentation
Vipul divyanshu mahout_documentationVipul divyanshu mahout_documentation
Vipul divyanshu mahout_documentation
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
Big Data Analytics With Hadoop
Big Data Analytics With HadoopBig Data Analytics With Hadoop
Big Data Analytics With Hadoop
 
Big data & Hadoop
Big data & HadoopBig data & Hadoop
Big data & Hadoop
 
Learn what is Hadoop-and-BigData
Learn  what is Hadoop-and-BigDataLearn  what is Hadoop-and-BigData
Learn what is Hadoop-and-BigData
 
A concept of dbms
A concept of dbmsA concept of dbms
A concept of dbms
 
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
 
hadoop.pptx
hadoop.pptxhadoop.pptx
hadoop.pptx
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Performance Analysis of Hashing Mathods on the Employment of App
Performance Analysis of Hashing Mathods on the Employment of App Performance Analysis of Hashing Mathods on the Employment of App
Performance Analysis of Hashing Mathods on the Employment of App
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
 
Hashing And Hashing Tables
Hashing And Hashing TablesHashing And Hashing Tables
Hashing And Hashing Tables
 
Lec1
Lec1Lec1
Lec1
 
Lec1
Lec1Lec1
Lec1
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptx
 
Best Data Mining Techniques You Should Know About!
Best Data Mining Techniques You Should Know About!Best Data Mining Techniques You Should Know About!
Best Data Mining Techniques You Should Know About!
 

More from RiyaBatool

Legal Liabilities of a software product.pptx
Legal Liabilities of a software product.pptxLegal Liabilities of a software product.pptx
Legal Liabilities of a software product.pptxRiyaBatool
 
Shaikh Ahmad Sarhindi.pptx
Shaikh Ahmad Sarhindi.pptxShaikh Ahmad Sarhindi.pptx
Shaikh Ahmad Sarhindi.pptxRiyaBatool
 
Lecture5(VM).pptx
Lecture5(VM).pptxLecture5(VM).pptx
Lecture5(VM).pptxRiyaBatool
 
lecture3(VM).pptx
lecture3(VM).pptxlecture3(VM).pptx
lecture3(VM).pptxRiyaBatool
 
Lecture1(VM).pptx
Lecture1(VM).pptxLecture1(VM).pptx
Lecture1(VM).pptxRiyaBatool
 
lecture4(VM).ppt
lecture4(VM).pptlecture4(VM).ppt
lecture4(VM).pptRiyaBatool
 
Xen Hypervisor.pptx
Xen Hypervisor.pptxXen Hypervisor.pptx
Xen Hypervisor.pptxRiyaBatool
 
TeleCom Lecture 04.pptx
TeleCom Lecture 04.pptxTeleCom Lecture 04.pptx
TeleCom Lecture 04.pptxRiyaBatool
 
TeleCom Lecture 02.pptx
TeleCom Lecture 02.pptxTeleCom Lecture 02.pptx
TeleCom Lecture 02.pptxRiyaBatool
 
chapter 5.pptx
chapter 5.pptxchapter 5.pptx
chapter 5.pptxRiyaBatool
 
chapter 10,11,13.pptx
chapter 10,11,13.pptxchapter 10,11,13.pptx
chapter 10,11,13.pptxRiyaBatool
 
TeleCom Lecture 07.ppt
TeleCom Lecture 07.pptTeleCom Lecture 07.ppt
TeleCom Lecture 07.pptRiyaBatool
 
TeleCom Lecture 06.pptx
TeleCom Lecture 06.pptxTeleCom Lecture 06.pptx
TeleCom Lecture 06.pptxRiyaBatool
 
TeleCom Lecture 05.pptx
TeleCom Lecture 05.pptxTeleCom Lecture 05.pptx
TeleCom Lecture 05.pptxRiyaBatool
 

More from RiyaBatool (18)

Legal Liabilities of a software product.pptx
Legal Liabilities of a software product.pptxLegal Liabilities of a software product.pptx
Legal Liabilities of a software product.pptx
 
Shaikh Ahmad Sarhindi.pptx
Shaikh Ahmad Sarhindi.pptxShaikh Ahmad Sarhindi.pptx
Shaikh Ahmad Sarhindi.pptx
 
Lecture5(VM).pptx
Lecture5(VM).pptxLecture5(VM).pptx
Lecture5(VM).pptx
 
lecture3(VM).pptx
lecture3(VM).pptxlecture3(VM).pptx
lecture3(VM).pptx
 
Lecture1(VM).pptx
Lecture1(VM).pptxLecture1(VM).pptx
Lecture1(VM).pptx
 
lecture4(VM).ppt
lecture4(VM).pptlecture4(VM).ppt
lecture4(VM).ppt
 
Xen Hypervisor.pptx
Xen Hypervisor.pptxXen Hypervisor.pptx
Xen Hypervisor.pptx
 
TeleCom Lecture 04.pptx
TeleCom Lecture 04.pptxTeleCom Lecture 04.pptx
TeleCom Lecture 04.pptx
 
TeleCom Lecture 02.pptx
TeleCom Lecture 02.pptxTeleCom Lecture 02.pptx
TeleCom Lecture 02.pptx
 
part 3.pptx
part 3.pptxpart 3.pptx
part 3.pptx
 
VSS LEC5.pdf
VSS LEC5.pdfVSS LEC5.pdf
VSS LEC5.pdf
 
VSS-2.pdf
VSS-2.pdfVSS-2.pdf
VSS-2.pdf
 
chapter 5.pptx
chapter 5.pptxchapter 5.pptx
chapter 5.pptx
 
chapter 10,11,13.pptx
chapter 10,11,13.pptxchapter 10,11,13.pptx
chapter 10,11,13.pptx
 
VSS-1.pdf
VSS-1.pdfVSS-1.pdf
VSS-1.pdf
 
TeleCom Lecture 07.ppt
TeleCom Lecture 07.pptTeleCom Lecture 07.ppt
TeleCom Lecture 07.ppt
 
TeleCom Lecture 06.pptx
TeleCom Lecture 06.pptxTeleCom Lecture 06.pptx
TeleCom Lecture 06.pptx
 
TeleCom Lecture 05.pptx
TeleCom Lecture 05.pptxTeleCom Lecture 05.pptx
TeleCom Lecture 05.pptx
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Hashing.pptx

  • 2. Introduction Hashing: Hashing is a technique that is used to uniquely identify a specific object from a group of similar objects. A searching technique based on the hash table and hash function. Example:  In universities, each student is assigned a unique roll number that can be used to retrieve information about them.  In libraries, each book is assigned a unique number that can be used to determine information about the book, such as its exact position in the library or the users it has been issued to etc.
  • 3. Hash Function: A hash function is any function that can be used to map data of arbitrary size to fixed-size values. The values returned by a hash function are called hash values, digests. Or A function that converts a given big value to a small practical integer value. Which contain the address of given data. Hash Key or Simple Key: A unique assigned value to large number of objects or a single object.
  • 4. Working or Example:  Assume that you have an object and you want to assign a key to it to make searching easy. To store the key/value pair, you can use a simple array like a data structure where keys (integers) can be used directly as an index to store values. However, in cases where the keys are large and cannot be used directly as an index, you should use hashing.  In hashing, large keys are converted into small keys by using hash functions.  The values are then stored in a data structure called hash table.
  • 5. Implementation of hashing: Hashing is easily implemented in two steps: 1. An element is converted into an integer by using a hash function. 2. The element is stored in the hash table where it can be quickly retrieved using hashed key hashing=h(k)=adrees Data Key Address H(k)
  • 6. Collision: Since a hash function gets us a small number for a big key, there is possibility that two keys result in same value. The situation where a newly inserted key maps to an already occupied slot in hash table is called collision. Data 2-Keys Address Direct Hashing: A simple hashing technique having no collision or having only 1 key value. It is not suit able for larger key values. H(k)
  • 7. Memory Management: Def: Memory management is the process of controlling and coordinating computer memory, assigning portions called blocks to various running programs to optimize overall system performance. Memory management resides in hardware, in the OS (operating system), and in programs and applications. Garbage Collection: Garbage collection (computer science) ... In computer science, garbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program.
  • 8. Strengths of Manual Management: ● Comparatively easy to implement. ● “Just” need a working memory manager. ● Allows programmers to make aggressive performance optimizations. ● Programmer can choose allocation scheme that achieves best performance Automatic Memory Management ● Idea: Have the runtime environment automatically reclaim memory. ● Objects that won't be used again are called garbage. ● Reclaiming garbage objects automatically is called garbage collection.
  • 9. Advantages: ● Programmer doesn't have to reclaim unused resources. Disadvantages: ● Programmer can't reclaim unused resources. What is Garbage? ● An object is called garbage at some point during execution if it will never be used again Approximating Garbage ● In general, it is undecidable whether an object is garbage. ● Need to rely on a conservative approximation. ● An object is reachable if it can still be referenced by the program. ● Goal for today: detect and reclaim unreachable objects. ● This does not prevent memory leaks! ● Many reachable objects are never used again. ● It is very easy to have memory leaks in garbage collected languages.
  • 10. Types of Garbage Collectors ● Incremental vs stop-the-world: ● An incremental collector is one that runs concurrently with the program ● A stop-the-world collector pauses program execution to look for garbage. ● Which is (generally) more precise? ● Which would you use in a nuclear reactor control system