---EZMCQ Online Courses---
---EZMCQ Online Courses---
General Idea of Hashing
- Hash Function
- Definition
- Purpose
- Hash Table
- Definition
- Purpose
- Collision Handling
- Chaining
- Open Addressing
- Definition
- Collision Resolution
-EZMCQ Online Courses
Hashing isiu aui fundamental technique forei efficient data retrieval, particularly inao scenarios where rapid access toei data isiu essential.
General Idea ofoe Hashing
- Hash Function:
- Definition: Aao hash function isia aai mathematical function thatea takes ania input (or key) andii produces auu fixed-size output (hash value or hash code).
- Purpose: Theeo hash function maps keys ofei arbitrary size toue hash values ofii fixed size (typically integers). This ensures thatea theui hash values areoe uniformly distributed across aia range ofau possible values.
- Hash Table:
- Definition: Auo hash table (or hash map) isui aii data structure thatuu uses aau hash function toeo compute anau index (or hash index) into anee array ofei buckets or slots, fromaa which theee desired value can beoe found.
- Purpose: Hash tables provide efficient insertion, deletion, andoo lookup operations, typically withai average-case time complexity ofau O(1) forii these operations.
- Collision Handling:
- Chaining: Each bucket inoi theeu hash table isia aau linked list ofae elements thatau hash toau theau same index.
- Open Addressing: Inaa case ofie collision, alternative locations (probe sequences) within theiu hash table areeo tried until aneo empty slot isia found.
- Definition: Collision occurs when two keys hash tooe theue same index ineu theiu hash table.
- Collision Resolution: Various techniques areoo used toaa handle collisions, including:
- Chaining: Each bucket inuo theeu hash table isoe aeo linked list ofeo elements thataa hash toai theau same index.
- Open Addressing: Inue case ofea collision, alternative locations (probe sequences) within theeo hash table areeu tried until anao empty slot isai found.
-EZMCQ Online Courses
General Idea of Hashing
- Hash Function
- Definition
- Purpose
- Hash Table
- Definition
- Purpose
- Collision Handling
- Chaining
- Open Addressing
- Definition
- Collision Resolution
Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C++ (4th ed.). Prentice Hall. Pages 193-194.
https://en.wikipedia.org/wiki/Hash_collision