100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Examen

Hashing Exam Practice Questions and Answers 2025 – Data Structures & Algorithms Study Guide – Complete Hash Functions, Collision Handling, and Hash Table Concepts

Puntuación
-
Vendido
6
Páginas
12
Grado
A+
Subido en
16-10-2025
Escrito en
2025/2026

Hashing Exam Practice Questions and Answers 2025 – Data Structures & Algorithms Study Guide – Complete Hash Functions, Collision Handling, and Hash Table Concepts

Institución
Hashing
Grado
Hashing









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Hashing
Grado
Hashing

Información del documento

Subido en
16 de octubre de 2025
Número de páginas
12
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

Hashing Exam

Hashing is a technique that is used to uniquely identify a specific object from a group of similar
objects. Some examples of how hashing is used in our lives include:

 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.

In both these examples the students and books were hashed to a unique number.

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. The idea of hashing is to distribute entries
(key/value pairs) uniformly across an array. Each element is assigned a key (converted key). By
using that key you can access the element in O(1) time. Using the key, the algorithm (hash
function) computes an index that suggests where an entry can be found or inserted.

Hashing is implemented in two steps:

1. An element is converted into an integer by using a hash function. This element can be
used as an index to store the original element, which falls into the hash table.
2. The element is stored in the hash table where it can be quickly retrieved using hashed
key.

hash = hashfunc(key)
index = hash % array_size

In this method, the hash is independent of the array size and it is then reduced to an index (a
number between 0 and array_size − 1) by using the modulo operator (%).

Hash function
A hash function is any function that can be used to map a data set of an arbitrary size to a data set
of a fixed size, which falls into the hash table. The values returned by a hash function are called
hash values, hash codes, hash sums, or simply hashes.

, To achieve a good hashing mechanism, It is important to have a good hash function with the
following basic requirements:

1. Easy to compute: It should be easy to compute and must not become an algorithm in
itself.
2. Uniform distribution: It should provide a uniform distribution across the hash table and
should not result in clustering.
3. Less collisions: Collisions occur when pairs of elements are mapped to the same hash
value. These should be avoided.

Note: Irrespective of how good a hash function is, collisions are bound to occur.
Therefore, to maintain the performance of a hash table, it is important to manage
collisions through various collision resolution techniques.

Need for a good hash function

Let us understand the need for a good hash function. Assume that you have to store strings in the
hash table by using the hashing technique {“abcdef”, “bcdefa”, “cdefab” , “defabc” }.

To compute the index for storing the strings, use a hash function that states the following:

The index for a specific string will be equal to the sum of the ASCII values of the characters
modulo 599.

As 599 is a prime number, it will reduce the possibility of indexing different strings (collisions).
It is recommended that you use prime numbers in case of modulo. The ASCII values of a, b, c, d,
e, and f are 97, 98, 99, 100, 101, and 102 respectively. Since all the strings contain the same
characters with different permutations, the sum will 599.

The hash function will compute the same index for all the strings and the strings will be stored in
the hash table in the following format. As the index of all the strings is the same, you can create a
list on that index and insert all the strings in that list.
$21.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
stillo University of Venda
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
4449
Miembro desde
1 año
Número de seguidores
3
Documentos
883
Última venta
2 días hace

4.7

260 reseñas

5
214
4
33
3
8
2
2
1
3

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes