Hash Function

Domain: Programming Fundamentals

🎯 Motivation

A hash function converts any input into a fixed-size number. It’s the engine behind dictionaries and much more.

πŸ“‹ Concrete Example

hash('hello') gives a number like -599545696. Same input always gives same output. Different inputs usually give different outputs.

πŸ”— Analogy

A librarian’s cataloguing system - you give them a book title (input), and they compute a shelf number (hash). Same title always goes to the same shelf.