What is the Hashing in DSA ? with Free Notes

What is the Hashing in DSA ?

Hashing is the technique which is used for efficient data retrieval in computer science. It involves mapping data to a fixed-size value or key using a hash function. This key is the used to index a data structure, typically a hash table, to quickly locate the desired data.

Hashing is widely used for various applications like, database, caching large datasets with minimal time complexity for search, insert and delete operations.

Advantages of Hashing

  1. Efficiency: – Average-case time complexity for search, insert and delete operations is O(1), making it highly efficient for large datasets.
  2. Simplicity: – Simple implementation and use in various applications.
  3. Versatility: – It is used in different sceneries like database indexing, caching and implementing associative arrays.

Dis-Advantages of Hashing

  1. Collision: – Handling collisions can complicate the implementation and effect performance.
  2. Space Overhead: – Hash Tables can consume more memory due to the need for additional storage for handling collisions and maintaining efficient load factors.
  3. Fixed Size: – The Hash table size must be often a prime number and may need resizing, which can be computationally expensive.
Hashing in DSA

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top