This document summarizes the seminar on hashing presented by Ms. Manisha Ruchika and Ritika. It discusses what hashing is, how records are inserted, deleted, and searched using hashing techniques. It explains hash functions and methods like division, mid-square, and folding. It describes collisions that can occur during insertion and the two approaches to resolve collisions - open addressing using linear probing, and chaining. It provides examples to illustrate key hashing concepts.
1) This document discusses number theory concepts such as divisibility, prime numbers, greatest common divisor, and relatively prime numbers. It provides definitions, theorems, and examples to illustrate these concepts.
2) Key concepts covered include the division algorithm, expressing integers in distributed bases, finding the greatest common divisor using factorization or the Euclidean algorithm, and determining when two numbers are relatively prime.
3) Theorems and proofs are provided to demonstrate properties such as squares of odd numbers being odd, and the remainder when dividing a specific expression by 3. Examples show working through calculations and proofs step-by-step.
1) The document discusses number theory concepts such as divisibility, prime numbers, greatest common divisor, and relatively prime numbers.
2) It provides definitions, theorems, proofs, and examples to illustrate these concepts. For instance, it defines the greatest common divisor (GCD) as the largest integer that divides two numbers and proves properties of GCD.
3) The document presents three methods - using common divisors, prime factorizations, and the division algorithm - to calculate the GCD of two numbers.
The document describes m-way search trees and B-trees, which are self-balancing search trees used to store and retrieve data efficiently. An m-way search tree allows each node to have up to m child nodes, with keys partitioning the keys in subtrees. B-trees are similar but require minimum node occupancy and keep leaf nodes at the same level. The text explains operations like searching, insertion, and deletion in these trees through examples and step-by-step procedures.
The document discusses solving various types of log and exponential equations. It includes examples of solving log equations with log 4 log(3 4)x x= − log 2 log( 24 4 )x x= − + and solving natural log equations like ln (3x+5)2 = 4 • ln x = 0.1. It also provides an example of solving an exponential equation like 205.27 2 =+x e 301 =+x e. For homework, it assigns problems from page 331, problems 1-18, 25-28, and 35-38.
The document discusses binary index trees (also called Fenwick trees) and segment trees, which are data structures that allow efficient querying of array prefixes and intervals. Binary index trees support adding values to array elements and retrieving prefix sums in O(log n) time. Segment trees similarly support adding values and finding maximum/minimum values in intervals in O(log n) time. Both achieve faster query times than naive solutions by representing the array as a tree structure.
Logarithmic expressions and properties are used to solve several examples:
(1) (x4)(x7) = x11 and log4 6 = log4 2 + log4 3 are shown;
(2) Finding log3 14 by rewriting it as log3 (2)(7) and using properties of logarithms;
(3) Solving an equation by rewriting it as a logarithmic expression and using properties to isolate the variable.
The document provides instructions for solving an ordinary differential equation using the finite element method. Specifically, it asks to:
1. Discretize the given differential equation over 7 equally spaced subintervals between 0 and 4.
2. Assemble the matrix equation from the discretized problem and calculate the load vector.
3. Solve the matrix equation to find the approximated solution at each node.
It then provides the details for constructing the stiffness matrix based on the given differential equation and basis functions over each subinterval.
This document discusses composition and decomposition of functions. It provides examples of composing functions by finding f(g(x)) and g(f(x)) for various functions f(x) and g(x). It also gives examples of decomposing a function h(x) into functions f(x) and g(x) such that h(x) = f(g(x)). The document announces there will be a quiz on this material and assigns homework problems for practice.
1) This document discusses number theory concepts such as divisibility, prime numbers, greatest common divisor, and relatively prime numbers. It provides definitions, theorems, and examples to illustrate these concepts.
2) Key concepts covered include the division algorithm, expressing integers in distributed bases, finding the greatest common divisor using factorization or the Euclidean algorithm, and determining when two numbers are relatively prime.
3) Theorems and proofs are provided to demonstrate properties such as squares of odd numbers being odd, and the remainder when dividing a specific expression by 3. Examples show working through calculations and proofs step-by-step.
1) The document discusses number theory concepts such as divisibility, prime numbers, greatest common divisor, and relatively prime numbers.
2) It provides definitions, theorems, proofs, and examples to illustrate these concepts. For instance, it defines the greatest common divisor (GCD) as the largest integer that divides two numbers and proves properties of GCD.
3) The document presents three methods - using common divisors, prime factorizations, and the division algorithm - to calculate the GCD of two numbers.
The document describes m-way search trees and B-trees, which are self-balancing search trees used to store and retrieve data efficiently. An m-way search tree allows each node to have up to m child nodes, with keys partitioning the keys in subtrees. B-trees are similar but require minimum node occupancy and keep leaf nodes at the same level. The text explains operations like searching, insertion, and deletion in these trees through examples and step-by-step procedures.
The document discusses solving various types of log and exponential equations. It includes examples of solving log equations with log 4 log(3 4)x x= − log 2 log( 24 4 )x x= − + and solving natural log equations like ln (3x+5)2 = 4 • ln x = 0.1. It also provides an example of solving an exponential equation like 205.27 2 =+x e 301 =+x e. For homework, it assigns problems from page 331, problems 1-18, 25-28, and 35-38.
The document discusses binary index trees (also called Fenwick trees) and segment trees, which are data structures that allow efficient querying of array prefixes and intervals. Binary index trees support adding values to array elements and retrieving prefix sums in O(log n) time. Segment trees similarly support adding values and finding maximum/minimum values in intervals in O(log n) time. Both achieve faster query times than naive solutions by representing the array as a tree structure.
Logarithmic expressions and properties are used to solve several examples:
(1) (x4)(x7) = x11 and log4 6 = log4 2 + log4 3 are shown;
(2) Finding log3 14 by rewriting it as log3 (2)(7) and using properties of logarithms;
(3) Solving an equation by rewriting it as a logarithmic expression and using properties to isolate the variable.
The document provides instructions for solving an ordinary differential equation using the finite element method. Specifically, it asks to:
1. Discretize the given differential equation over 7 equally spaced subintervals between 0 and 4.
2. Assemble the matrix equation from the discretized problem and calculate the load vector.
3. Solve the matrix equation to find the approximated solution at each node.
It then provides the details for constructing the stiffness matrix based on the given differential equation and basis functions over each subinterval.
This document discusses composition and decomposition of functions. It provides examples of composing functions by finding f(g(x)) and g(f(x)) for various functions f(x) and g(x). It also gives examples of decomposing a function h(x) into functions f(x) and g(x) such that h(x) = f(g(x)). The document announces there will be a quiz on this material and assigns homework problems for practice.
The document discusses solving equations with radicals by working through examples of solving various equations with radicals. It demonstrates taking square roots and cube roots of both sides of equations to solve for variables. It also discusses the concept of extraneous solutions that may arise when solving equations with radicals.
35182797 additional-mathematics-form-4-and-5-notesWendy Pindah
1) The function f(x) = 2x^2 + 8x + 6 can be written as f(x) = 2(x+2)^2 - 2. The maximum point is (-2, -2) and the equation of the tangent at this point is y = -2.
2) The function f(x) = -(x-4)^2 + h has a maximum point at (k, 9) so k = 4 and h = 9.
3) The function y = (x+m)^2 + n has an axis of symmetry at x = -m. Given the axis is x = 1, m = -1 and the minimum point is (1
The document discusses coordinate graphing and plotting points on a graph. It explains that coordinate points (x, y) involve first plotting the x value by moving left or right on the x-axis, then plotting the y value by moving up or down on the y-axis. Several examples of coordinate points are given. It also discusses the four quadrants of the coordinate plane and using equations like y=2x+5 to generate coordinate point pairs.
Tugas 5.6 kalkulus aplikasi integral tentu (luas bidang datar)Nurkhalifah Anwar
The document contains calculations to find the total area (∆(R)) of shaded regions bounded by curves over given intervals using integral calculus. Several examples are worked through step-by-step showing the setup and evaluation of definite integrals to obtain the shaded area values. The areas found include 8/3, 2, 4√2, π/2, 128/15, 1/12, and 4/3 units.
This document discusses exponents and powers. It begins with an introduction that explains how exponents are used to write very large numbers in a shorter form. It then defines exponents and bases. Several laws of exponents are covered, including multiplying and dividing powers with the same base, taking powers of powers, and multiplying powers with the same exponent. Examples are provided to illustrate each law and concept. The document appears to be from a textbook on exponents and powers for students.
The document contains a 10 minute quiz on quadratic equations with 3 questions. The first question asks to find the value of k given that x=4 is a root of the equation 2x^2 - kx - 12 = 0. The second asks to find the range of values for p given that the equation x^2 - 5x + p = 0 has two different roots. The third asks to find the range of values for q given that the equation 3x^2 - 6x + 4q = 0 has no roots.
The document discusses exponents and operations involving exponents. It provides examples of evaluating expressions with exponents, such as 52 = 25 and (-5)2 = 25. It also covers the rules for exponents, such as when a term is inside parentheses the entire term is raised to the power, and when outside only the base. Negative exponents are introduced, following the pattern that x-1 = 1/x.
This document contains homework questions from Mrs. Ramsey's pre-calculus class. It includes exercises to find the domain of various algebraic expressions and functions, including rational, logarithmic, and exponential functions. Students are asked to compute compositions of functions f(g(x)) and g(f(x)) and state their domains for different functions defined piecewise or implicitly. The document provides practice working with domains, an important concept in pre-calculus.
Factors of po lynomials + solving equationsShaun Wilson
This document discusses factorizing polynomials of degree 3 or higher using the factor theorem or "The Big L" method. It provides examples of factorizing polynomials and using the factors to find the roots or solutions of polynomial equations. The examples show setting a polynomial equal to 0, finding a factor using the factor theorem, fully factorizing the polynomial, and then setting each factor equal to 0 to obtain the roots. The document emphasizes that the factor theorem can be used to determine if an expression is a factor if the remainder is 0 upon dividing the polynomial by the expression.
This document discusses hash tables and how they work. Hash tables store records with keys in an array. To insert a record, its key is hashed to a location in the array. If that location is occupied, the next available empty location is used instead. Searching for a record's key involves hashing the key and checking locations until the key is found or an empty spot is reached. When deleting a record, its location must be marked as deleted rather than left empty to avoid interfering with searches.
CS-102 Data Structures HashFunction CS102.pdfssuser034ce1
Hashing is a technique for implementing dictionaries that provides constant time per operation on average. It works by using a hash function to map keys to positions in a hash table. Ideally, an element with key k would be stored at position h(k). However, collisions can occur if multiple keys map to the same position. When a collision occurs, the element is stored in the next available empty position. Searching for an element involves computing its hash value to locate its position, and searching linearly if a collision is encountered. Deletion requires marking deleted positions as empty rather than truly empty to avoid interfering with searches.
Searching Algorithms with Binary Search and Hashing Concept with Time and Spa...mrhabib10
The document discusses different search algorithms for efficiently finding records in a list given a key, including serial search, binary search, and hash tables. Serial search has O(n) worst-case time complexity, while binary search of a sorted list has O(log n) worst-case time complexity. Hash tables can provide constant time O(1) search by mapping keys to array indices via a hash function, but collisions require probing to find empty slots.
The document discusses different search algorithms for efficiently finding a record with a particular key in a list of records. It describes serial search, which has O(n) worst-case and average-case time complexity, and binary search, which has O(log n) worst-case and average-case time complexity for sorted lists. The document then introduces hash tables as a way to search in O(1) time by using a hash function to map keys to array indices, though collisions require searching further in the array.
The document discusses different algorithms for searching through a list of records to find a record with a particular key:
1) Serial search simply iterates through each record sequentially until the target key is found, with average case time complexity of O(n).
2) Binary search can be used if the records are sorted, performing a divide and conquer search with average and worst case time complexity of O(logn).
3) Hash tables map keys to array indices via a hash function, allowing direct access to records in O(1) time on average by resolving collisions through open addressing. This provides the most efficient search algorithm discussed.
Bsc cs ii dfs u-4 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, which can cause collisions when different keys hash to the same index. It also covers inserting and searching for records, handling collisions, and deleting records from the hash table.
Bca ii dfs u-4 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, which can cause collisions when different keys hash to the same index. It also covers inserting and searching for records, handling collisions, and deleting records from the hash table.
Mca ii dfs u-5 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, allowing for fast insertion, searching and retrieval of records. Collisions, where two keys hash to the same index, are addressed using techniques like chaining. The document also covers file structures, comparing sequential and indexed files, and how different file organizations like fixed-length records handle storing variable-length records.
The document discusses hash tables and collision resolution techniques for hash tables. It defines hash tables as an implementation of dictionaries that use hash functions to map keys to array slots. Collisions occur when multiple keys hash to the same slot. Open addressing techniques like linear probing and quadratic probing search the array sequentially for empty slots when collisions occur. Separate chaining creates an array of linked lists so items can be inserted into lists when collisions occur.
The document discusses different search algorithms for efficiently finding a record with a particular key in a list of records. Serial search compares the key to each record sequentially, having worst-case time complexity of O(n). Binary search works on a sorted list, dividing the search space in half at each step to find the record in O(log n) time on average and worst case. Indexed sequential search uses an index to guide the search, first looking in the index then searching relevant blocks of the array to improve efficiency over serial search.
The document summarizes four common searching algorithms: sequential search, binary search, interpolation search, and hashing. Sequential search looks at elements in order from first to last. Binary search divides the search space in half at each step. Interpolation search estimates where an element may be located based on value distribution. Hashing uses a hash function to map elements to array indices, handling collisions by probing to next open index.
The document discusses different hashing techniques used to store and retrieve data in hash tables. It begins by motivating the need for hashing through the limitations of linear and binary search. It then defines hashing as a process to map keys of arbitrary size to fixed size values. Popular hash functions discussed include division, folding, and mid-square methods. The document also covers collision resolution techniques for hash tables, including open addressing methods like linear probing, quadratic probing and double hashing as well as separate chaining using linked lists.
Hash tables store key-value pairs by using a hash function to map keys to array positions. Collisions occur when different keys hash to the same position. Open addressing resolves collisions by probing to alternate positions using techniques like linear probing, quadratic probing, or double hashing. Chaining resolves collisions by storing keys at the same position in a linked list. Common hash functions include division, multiplication, mid-square, and folding methods.
The document discusses solving equations with radicals by working through examples of solving various equations with radicals. It demonstrates taking square roots and cube roots of both sides of equations to solve for variables. It also discusses the concept of extraneous solutions that may arise when solving equations with radicals.
35182797 additional-mathematics-form-4-and-5-notesWendy Pindah
1) The function f(x) = 2x^2 + 8x + 6 can be written as f(x) = 2(x+2)^2 - 2. The maximum point is (-2, -2) and the equation of the tangent at this point is y = -2.
2) The function f(x) = -(x-4)^2 + h has a maximum point at (k, 9) so k = 4 and h = 9.
3) The function y = (x+m)^2 + n has an axis of symmetry at x = -m. Given the axis is x = 1, m = -1 and the minimum point is (1
The document discusses coordinate graphing and plotting points on a graph. It explains that coordinate points (x, y) involve first plotting the x value by moving left or right on the x-axis, then plotting the y value by moving up or down on the y-axis. Several examples of coordinate points are given. It also discusses the four quadrants of the coordinate plane and using equations like y=2x+5 to generate coordinate point pairs.
Tugas 5.6 kalkulus aplikasi integral tentu (luas bidang datar)Nurkhalifah Anwar
The document contains calculations to find the total area (∆(R)) of shaded regions bounded by curves over given intervals using integral calculus. Several examples are worked through step-by-step showing the setup and evaluation of definite integrals to obtain the shaded area values. The areas found include 8/3, 2, 4√2, π/2, 128/15, 1/12, and 4/3 units.
This document discusses exponents and powers. It begins with an introduction that explains how exponents are used to write very large numbers in a shorter form. It then defines exponents and bases. Several laws of exponents are covered, including multiplying and dividing powers with the same base, taking powers of powers, and multiplying powers with the same exponent. Examples are provided to illustrate each law and concept. The document appears to be from a textbook on exponents and powers for students.
The document contains a 10 minute quiz on quadratic equations with 3 questions. The first question asks to find the value of k given that x=4 is a root of the equation 2x^2 - kx - 12 = 0. The second asks to find the range of values for p given that the equation x^2 - 5x + p = 0 has two different roots. The third asks to find the range of values for q given that the equation 3x^2 - 6x + 4q = 0 has no roots.
The document discusses exponents and operations involving exponents. It provides examples of evaluating expressions with exponents, such as 52 = 25 and (-5)2 = 25. It also covers the rules for exponents, such as when a term is inside parentheses the entire term is raised to the power, and when outside only the base. Negative exponents are introduced, following the pattern that x-1 = 1/x.
This document contains homework questions from Mrs. Ramsey's pre-calculus class. It includes exercises to find the domain of various algebraic expressions and functions, including rational, logarithmic, and exponential functions. Students are asked to compute compositions of functions f(g(x)) and g(f(x)) and state their domains for different functions defined piecewise or implicitly. The document provides practice working with domains, an important concept in pre-calculus.
Factors of po lynomials + solving equationsShaun Wilson
This document discusses factorizing polynomials of degree 3 or higher using the factor theorem or "The Big L" method. It provides examples of factorizing polynomials and using the factors to find the roots or solutions of polynomial equations. The examples show setting a polynomial equal to 0, finding a factor using the factor theorem, fully factorizing the polynomial, and then setting each factor equal to 0 to obtain the roots. The document emphasizes that the factor theorem can be used to determine if an expression is a factor if the remainder is 0 upon dividing the polynomial by the expression.
This document discusses hash tables and how they work. Hash tables store records with keys in an array. To insert a record, its key is hashed to a location in the array. If that location is occupied, the next available empty location is used instead. Searching for a record's key involves hashing the key and checking locations until the key is found or an empty spot is reached. When deleting a record, its location must be marked as deleted rather than left empty to avoid interfering with searches.
CS-102 Data Structures HashFunction CS102.pdfssuser034ce1
Hashing is a technique for implementing dictionaries that provides constant time per operation on average. It works by using a hash function to map keys to positions in a hash table. Ideally, an element with key k would be stored at position h(k). However, collisions can occur if multiple keys map to the same position. When a collision occurs, the element is stored in the next available empty position. Searching for an element involves computing its hash value to locate its position, and searching linearly if a collision is encountered. Deletion requires marking deleted positions as empty rather than truly empty to avoid interfering with searches.
Searching Algorithms with Binary Search and Hashing Concept with Time and Spa...mrhabib10
The document discusses different search algorithms for efficiently finding records in a list given a key, including serial search, binary search, and hash tables. Serial search has O(n) worst-case time complexity, while binary search of a sorted list has O(log n) worst-case time complexity. Hash tables can provide constant time O(1) search by mapping keys to array indices via a hash function, but collisions require probing to find empty slots.
The document discusses different search algorithms for efficiently finding a record with a particular key in a list of records. It describes serial search, which has O(n) worst-case and average-case time complexity, and binary search, which has O(log n) worst-case and average-case time complexity for sorted lists. The document then introduces hash tables as a way to search in O(1) time by using a hash function to map keys to array indices, though collisions require searching further in the array.
The document discusses different algorithms for searching through a list of records to find a record with a particular key:
1) Serial search simply iterates through each record sequentially until the target key is found, with average case time complexity of O(n).
2) Binary search can be used if the records are sorted, performing a divide and conquer search with average and worst case time complexity of O(logn).
3) Hash tables map keys to array indices via a hash function, allowing direct access to records in O(1) time on average by resolving collisions through open addressing. This provides the most efficient search algorithm discussed.
Bsc cs ii dfs u-4 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, which can cause collisions when different keys hash to the same index. It also covers inserting and searching for records, handling collisions, and deleting records from the hash table.
Bca ii dfs u-4 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, which can cause collisions when different keys hash to the same index. It also covers inserting and searching for records, handling collisions, and deleting records from the hash table.
Mca ii dfs u-5 sorting and searching structureRai University
This document discusses hash tables and their use for storing and retrieving data records. It describes how a hash table uses a hash function to map record keys to array indexes, allowing for fast insertion, searching and retrieval of records. Collisions, where two keys hash to the same index, are addressed using techniques like chaining. The document also covers file structures, comparing sequential and indexed files, and how different file organizations like fixed-length records handle storing variable-length records.
The document discusses hash tables and collision resolution techniques for hash tables. It defines hash tables as an implementation of dictionaries that use hash functions to map keys to array slots. Collisions occur when multiple keys hash to the same slot. Open addressing techniques like linear probing and quadratic probing search the array sequentially for empty slots when collisions occur. Separate chaining creates an array of linked lists so items can be inserted into lists when collisions occur.
The document discusses different search algorithms for efficiently finding a record with a particular key in a list of records. Serial search compares the key to each record sequentially, having worst-case time complexity of O(n). Binary search works on a sorted list, dividing the search space in half at each step to find the record in O(log n) time on average and worst case. Indexed sequential search uses an index to guide the search, first looking in the index then searching relevant blocks of the array to improve efficiency over serial search.
The document summarizes four common searching algorithms: sequential search, binary search, interpolation search, and hashing. Sequential search looks at elements in order from first to last. Binary search divides the search space in half at each step. Interpolation search estimates where an element may be located based on value distribution. Hashing uses a hash function to map elements to array indices, handling collisions by probing to next open index.
The document discusses different hashing techniques used to store and retrieve data in hash tables. It begins by motivating the need for hashing through the limitations of linear and binary search. It then defines hashing as a process to map keys of arbitrary size to fixed size values. Popular hash functions discussed include division, folding, and mid-square methods. The document also covers collision resolution techniques for hash tables, including open addressing methods like linear probing, quadratic probing and double hashing as well as separate chaining using linked lists.
Hash tables store key-value pairs by using a hash function to map keys to array positions. Collisions occur when different keys hash to the same position. Open addressing resolves collisions by probing to alternate positions using techniques like linear probing, quadratic probing, or double hashing. Chaining resolves collisions by storing keys at the same position in a linked list. Common hash functions include division, multiplication, mid-square, and folding methods.
The document discusses different techniques for storing and searching data, including sequential search, binary search, and hashing. It provides details on open hashing and closed hashing, describing that closed hashing stores elements within buckets and can cause collisions when multiple elements are mapped to the same bucket. The document also outlines characteristics of good hash functions and different hashing methods like division, mid-square, folding, digit analysis, length dependent, algebraic coding, and multiplicative hashing.
Arrays allow storing and manipulating a collection of related data elements. They can hold groups of integers, characters, or other data types. Declaring individual variables becomes difficult when storing many elements, so arrays provide an efficient solution. Arrays are declared with a datatype and size, and elements can be initialized, accessed, inserted, deleted, and manipulated using their index positions. Common array operations include displaying values, finding maximum/minimum values, calculating sums, and passing arrays to functions. Multi-dimensional arrays extend the concept to store elements in a table structure accessed by row and column indexes.
1. The document discusses searching and hashing algorithms. It describes linear and binary searching techniques. Linear search has O(n) time complexity, while binary search has O(log n) time complexity for sorted arrays.
2. Hashing is described as a technique to allow O(1) access time by mapping keys to table indexes via a hash function. Separate chaining and open addressing are two common techniques for resolving collisions when different keys hash to the same index. Separate chaining uses linked lists at each table entry while open addressing probes for the next open slot.
The document discusses different representations of signed integers in binary, including sign-magnitude, one's complement, and two's complement. It also covers binary addition and subtraction using two's complement representation. Memory locations are addressed and memory operations like load, store are explained. Different instruction formats like one-address, two-address, three-address are introduced along with examples.
The document describes a C++ program that implements a dictionary abstract data type (ADT) using hashing without replacement. The program defines a HashFunction class with functions to insert key-value pairs into a hash table, display the hash table, find a key, and delete a key. It tests the functions by running sample inputs of inserting, finding, deleting, and displaying keys from the hash table.
The document discusses quicksort analysis and ways to improve its performance. It shows that quicksort has a best case running time of O(n log n) when keys are randomly distributed, but a worst case of O(n^2) if the array is already sorted. To avoid the worst case, the document suggests improving pivot selection by choosing the median of three randomly selected elements rather than just the first element. It also recommends using brute force for small subarrays of size 3 or less.
Hashing is a technique for storing data in an array-like structure that allows for fast lookup of data based on keys. It improves upon linear and binary search by avoiding the need to keep data sorted. Hashing works by using a hash function to map keys to array indices, with collisions resolved through techniques like separate chaining or open addressing. Separate chaining uses linked lists at each index while open addressing resolves collisions by probing to alternate indices like linear, quadratic, or double hashing.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Communicating effectively and consistently with students can help them feel at ease during their learning experience and provide the instructor with a communication trail to track the course's progress. This workshop will take you through constructing an engaging course container to facilitate effective communication.
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Hashing in DS
1. SEMINAR ON HASHING
PRESENTED TO: PRESENTED BY:
MS. MANISHA RUCHIKA(6)
RITIKA(11)
MCA 1
S.S.D WOMEN’S INSTITUTE OF TECHNOLOGY, BATHINDA
(AFFILIATED TO PUNJABI UNIVERSITY,PATIALA)
2. CONTENTS
What is hashing?What is hashing?
Inserting ,deleting and searching a recordInserting ,deleting and searching a record
hash functions and their methodshash functions and their methods
CollisionCollision
Two ways of collision resolutionTwo ways of collision resolution
1.1. open addressingopen addressing
2.2. ChainingChaining
3. Hashing are a common
approach to the
storing/searching problem.
A collection of data is
stored ,and each data item
has a key associated with it.
Hashing
4. What is a Hash Table ?
The simplest kind of hash
table is an array of records.
This example has 701
records.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
An array of records
. . .
[ 700]
5. What is a Hash Table ?
Each record has a special
field, called its key.
In this example, the key is a
long integer field called
Number.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
. . .
[ 700]
[ 4 ]
Number 506643548
6. What is a Hash Table ?
The number might be a
person's identification
number, and the rest of the
record has information
about the person.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
. . .
[ 700]
[ 4 ]
Number 506643548
7. What is a Hash Table ?
When a hash table is in use,
some spots contain valid
records, and other spots are
"empty".
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
8. The general idea of using theThe general idea of using the keykey to determine the address of ato determine the address of a
record is an excellent idea, but it must be modified so that a greatrecord is an excellent idea, but it must be modified so that a great
deal of space is not wasted.deal of space is not wasted.
This modification takes the form of a function H from the set K ofThis modification takes the form of a function H from the set K of
keys in to the set L of memory addresses.keys in to the set L of memory addresses.
H : KH : K L (hash function)L (hash function)
Chop is a technique, in which combine the pieces of key K to formChop is a technique, in which combine the pieces of key K to form
the hash address H(k).the hash address H(k).
key
key1 key2
Key1.1 Key1.2
9. Methods of Hash Functions
Division methodDivision method:- Choose a number m larger than the:- Choose a number m larger than the
number n of keys in k.number n of keys in k.
The hash function H is defined byThe hash function H is defined by
H(k)=k(mod m) or H(k)=k(mod m) +1H(k)=k(mod m) or H(k)=k(mod m) +1
k(mod m) denotes the remainder when k is divided by m.k(mod m) denotes the remainder when k is divided by m.
Second formula is used when we want the hash addressesSecond formula is used when we want the hash addresses
to range from 1 to m. rather than o to m-1to range from 1 to m. rather than o to m-1..
10. Example of division method
68 employees is assigned a unique 4-digit employee68 employees is assigned a unique 4-digit employee
number. Suppose L consists of 100 two-digit addresses.number. Suppose L consists of 100 two-digit addresses.
00,01,02,……99. we apply the division method to each of00,01,02,……99. we apply the division method to each of
the employee number: 3205, 7148, 2345.the employee number: 3205, 7148, 2345.
1. Choose a prime number m close to 99 such as m=97. then1. Choose a prime number m close to 99 such as m=97. then
H(3205)=4 , H(7148)=67 , H(2345)=17.H(3205)=4 , H(7148)=67 , H(2345)=17.
2. H(3205)=4+1=52. H(3205)=4+1=5
H(7148)=67+1=68H(7148)=67+1=68
H(2345)=17+1=18H(2345)=17+1=18
11. Mid square method
The key k is squared. Than the hash function H is definedThe key k is squared. Than the hash function H is defined
byby
H(k)=lH(k)=l
Here l is obtained by deleting digits from both ends of k*k.Here l is obtained by deleting digits from both ends of k*k.
Example:Example:
k: 3205k: 3205 71487148 23452345
k*k: 10 272 025k*k: 10 272 025 51 093 90451 093 904 5 499 0255 499 025
H(k): 72H(k): 72 9393 9999
12. Folding method
The key k is partitioned into a number of parts, k1,k2,The key k is partitioned into a number of parts, k1,k2,
….kr.….kr.
Parts are added together, ignoring the last carry.Parts are added together, ignoring the last carry.
H(k)=k1+k2+……+krH(k)=k1+k2+……+kr
Example:-Example:-
H(3205)=32+05=37H(3205)=32+05=37
H(7148)=71+48=19 (the leading digit 1 in this is ignored).H(7148)=71+48=19 (the leading digit 1 in this is ignored).
H(2345)=23+45=68H(2345)=23+45=68
13. Inserting a New Record
In order to insert a new
record, the key must
somehow be converted to an
array index.
The index is called the hash
value of the key.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
14. Inserting a New Record
Typical way create a hash
value:
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
(Number mod 701)
What is (580625685 mod 701) ?
15. Inserting a New Record
Typical way to create a hash
value:
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
(Number mod 701)
What is (580625685 mod 701) ?
3
16. Inserting a New Record
The hash value is used for
the location of the new
record.
Number 580625685
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
[3]
17. Inserting a New Record
The hash value is used for
the location of the new
record.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
18. Collisions
Here is another new record
to insert, with a hash value
of 2.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
Number 701466868
My hash
value is [2].
19. Collisions
This is called a collision,
because there is already
another valid record at [2].
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
Number 701466868
When a collision
occurs,
move forward until you
find an empty spot.
20. Collisions
This is called a collision,
because there is already
another valid record at [2].
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
Number 701466868
When a collision
occurs,
move forward until you
find an empty spot.
21. Collisions
This is called a collision,
because there is already
another valid record at [2].
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685
Number 701466868
When a collision
occurs,
move forward until you
find an empty spot.
22. Collisions
This is called a collision,
because there is already
another valid record at [2].
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
The new record goes
in the empty spot.
23. Searching for a Key
The data that's attached to a
key can be found fairly
quickly.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
24. Searching for a Key
Calculate the hash value.
Check that location of the array
for the key.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
My hash
value is [2].
Not me.
25. Searching for a Key
Keep moving forward until you
find the key, or you reach an
empty spot.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
My hash
value is [2].
Not me.
26. Searching for a Key
Keep moving forward until you
find the key, or you reach an
empty spot.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
My hash
value is [2].
Not me.
27. Searching for a Key
Keep moving forward until you
find the key, or you reach an
empty spot.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
My hash
value is [2].
Yes!
28. Searching for a Key
When the item is found, the
information can be copied to
the necessary location.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Number 701466868
My hash
value is [2].
Yes!
29. Deleting a Record
Records may also be deleted from a hash table.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 506643548Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Please
delete me.
30. Deleting a Record
Records may also be deleted from a hash table.
But the location must not be left as an ordinary
"empty spot" since that could interfere with searches.
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
31. Deleting a Record
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 700]
Number 233667136Number 281942902
Number 155778322
. . .
Number 580625685 Number 701466868
Records may also be deleted from a hash table.
But the location must not be left as an ordinary
"empty spot" .
The location must be marked in some special way so
that a search can tell that the spot used to have
something in it.
32. COLLISION RESOLUTION
There are two general ways of resolving collisions.There are two general ways of resolving collisions.
The particular procedure that one chooses depends on manyThe particular procedure that one chooses depends on many
factors. One important factor is the ratio of the number n of keysfactors. One important factor is the ratio of the number n of keys
in K(which is the number of the record in F) to the number m ofin K(which is the number of the record in F) to the number m of
hash addresses in L. this ratio, = n/m is called load factor.hash addresses in L. this ratio, = n/m is called load factor.
n= number of filled records.n= number of filled records.
m= total number of memory locations.m= total number of memory locations.
33. The efficiency ofThe efficiency of hash functionhash function with a collision resolutionwith a collision resolution
procedure is measured by the average number ofprocedure is measured by the average number of
probes(key comparisons) needed to find the location of theprobes(key comparisons) needed to find the location of the
record with a given key k.the efficiency depends mainly onrecord with a given key k.the efficiency depends mainly on
the load factor . The following two quantities:the load factor . The following two quantities:
S( )S( ) = average number of probes for a successful search.= average number of probes for a successful search.
U( ) = average number of probes for an unsuccessful search.U( ) = average number of probes for an unsuccessful search.
34. Open addressing
If the home slot for the record that is being inserted is alreadyIf the home slot for the record that is being inserted is already
occupied, then simply choose a different location with in the tableoccupied, then simply choose a different location with in the table..
But…how do we choose this alternate location?
The technique must be reproducible, and on average be cheap.
35. Linear Probing
Linear probing involves simply walking down the table until anLinear probing involves simply walking down the table until an
empty slot is foundempty slot is found..
36. Drawbacks of linear probing
The major drawbacks of linear probing is that, as the tableThe major drawbacks of linear probing is that, as the table
becomes about half full, here is a tendency towardbecomes about half full, here is a tendency toward
clusteringclustering..
The sequential searches needed to find an empty positionThe sequential searches needed to find an empty position
become longer and longer.become longer and longer.
Example:- if a new insertion hashes to location b, then it willExample:- if a new insertion hashes to location b, then it will
go there, but if it hashes to location a, then it will also gogo there, but if it hashes to location a, then it will also go
into b.into b.
a b c d e
37. The problem of clustering is essentially one ofThe problem of clustering is essentially one of instabilityinstability..
If a few keys happen randomly to be near each other, thenIf a few keys happen randomly to be near each other, then
it becomes more and more likely that other keys will joinit becomes more and more likely that other keys will join
them, and the distribution will become progressively morethem, and the distribution will become progressively more
unbalancedunbalanced..
38. Avoid the problem of
clustering
Quadratic probing:-Quadratic probing:- suppose a record R with key k has thesuppose a record R with key k has the
hash address H(k)=h. then, instead of searching the locationshash address H(k)=h. then, instead of searching the locations
with addresses h, h+1, h+2,…. We linearly search thewith addresses h, h+1, h+2,…. We linearly search the
locations with addresses.locations with addresses.
h, h+1, h+4, h+9, h+16,….h+i^2…h, h+1, h+4, h+9, h+16,….h+i^2…
If the number m of locations in the table T is a prime number,If the number m of locations in the table T is a prime number,
then the above sequence will access half of the locations in T.then the above sequence will access half of the locations in T.
39. Double Hashing
A second hash function H’ is used for resolving aA second hash function H’ is used for resolving a
collision. Suppose a record R with key k has the hashcollision. Suppose a record R with key k has the hash
addresses H(k)=h and H’(k)= h’ m then we linearlyaddresses H(k)=h and H’(k)= h’ m then we linearly
search the locations with addresses.search the locations with addresses.
h, h+h’, h+2h’, h+3h’,….h, h+h’, h+2h’, h+3h’,….
if m is a prime number , then the above sequence all theif m is a prime number , then the above sequence all the
locations in the table T.locations in the table T.
40. Chaining
Design the table so that each slot is actually a container that can hold multiple records.
Here, the “chains" are linked lists which could hold any number of colliding records.
Alternatively each table slot could be large enough to store several records directly…in that
case the slot may overflow, requiring a fallback…
This lecture illustrates hash tables, using open addressing.
Before this lecture, students should have seen other forms of a Dictionary, where a collection of data is stored, and each data item has a key associated with it.
This lecture introduces hash tables, which are an array-based method for implementing a Dictionary. You should recall that we have seen dictionaries implemented in other ways, for example with a binary search tree. The abstract properties of a dictionary remain the same: We can insert items in the dictionary, and each item has a key associated with it. When we want to retrieve an item, we specify only the key, and the retrieval process finds the associated data.
What we do now is use an array to implement the dictionary. The array is an array of records. In this example, we could store up to 701 records in the array.
Each record in the array contains two parts. The first part is a number that we'll use for the key of the item. We could use something else for the keys, such as a string. But for a hash table, numbers make the most convenient keys.
The numbers might be identification numbers of some sort, and the rest of the record contains information about a person. So the pattern that you see here is the same pattern that you've seen in other dictionaries: Each entry in the dictionary has a key (in this case an identifying number) and some associated data.
When a hash table is being used as a dictionary, some of the array locations are in use, and other spots are "empty", waiting for a new entry to come along.
Oftentimes, the empty spots are identified by a special key. For example, if all our identification numbers are positive, then we could use 0 as the Number that indicates an empty spot.
With this drawing, locations [0], [4], [6], and maybe some others would all have Number=0.
In order to insert a new entry, the key of the entry must somehow be converted to an index in the array. For our example, we must convert the key number into an index between 0 and 700. The conversion process is called hashing and the index is called the hash value of the key.
There are many ways to create hash values. Here is a typical approach.
a. Take the key mod 701 (which could be anywhere from 0 to 700).
So, quick, what is (580,625,685 mod 701) ?
Three.
So, this new item will be placed at location [3] of the array.
The hash value is always used to find the location for the record.
Sometimes, two different records might end up with the same hash value.
This is called a collision.
When a collision occurs, the insertion process will move forward through the array until an empty spot is found. Sometimes you will have a second collision...
...and a third collision...
But if there are any empty spots, eventually you will reach an empty spot, and the new item is inserted here.
The new record is always placed in the first available empty spot, after the hash value.
It is fairly easy to search for a particular item based on its key.
Start by computing the hash value, which is 2 in this case. Then check location 2. If location 2 has a different key than the one you are looking for, then move forward...
...if the next location is not the one we are looking for, then keep moving forward...
Keep moving forward until you find the sought-after key...
In this case we find the key at location [5].
The data from location [5] can then be copied to to provide the result of the search function.
What happens if a search reaches an empty spot? In that case, it can
halt and indicate that the key was not in the hash table.
Records can be deleted from a hash table...
But the spot of the deleted record cannot be left as an ordinary empty spot, since that would interfere with searches. (Remember that a search can stop when it reaches an empty spot.)
Instead we must somehow mark the location as "a location that used to have something here, but no longer does."
We might do this by using some other special value for the Number field of the record.
In any case, a search can not stop when it reaches "a location that used to have something here". A search can only stop when it reaches a true empty spot.