Monday, November 20, 2023

The goal of hashing is to produce a search that takes.......................

 



ANSWER:    O(1) time


Hashing is the process of transforming any given key or a string of characters into another value.

Hashing is a process of generating fixed-size output from an input of variable size using mathematical formula known as hash functions. The input can be of any size but output (hash value) will always be a fixed length.

Hash stores the data in associative manner in an array where each data value has its own unique index.

The hash data structure is used due to it’s efficiency. Using hash data structure, it is easy to store data in constant time and retrive the data in constant time. It takes O(1) time in searching the data.

In hashing process there is a possibility that two keys could produce the same value. The situation where the newly inserted key maps to an already occupied cell is called collision.

There are two ways of handling collision

1. Seperate chaining

2. Open addressing

The main advantage of using hash data structure is, it provides constant time for searching, insertion and deletion operation. 

0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top