liveBook · Manning

Hash collision

A hash collision occurs when distinct inputs to a hash function produce the same hash value or map to the same hash-table location.

How 6 Manning books explain it

Algorithms Every Programmer Should Know

A hash collision occurs when distinct keys produce the same hash index or hash value.

How it is used
Explains false matches in Rabin–Karp and performance loss in hash maps.
How deep it goes
Defines collisions, demonstrates weak and improved string hashes, and traces verification and worst-case costs.
Examples
Uses ACT and CAT to show an anagram collision and contrasts simple addition with positional powers.
What you can do after
Diagnose weak hashing by recognizing spurious hits, checking matching strings, and considering performance degradation.

Read how Algorithms Every Programmer Should Know explains hash collision →

Grokking Algorithms, Second Edition

A hash collision occurs when distinct keys produce the same hash value or table position.

How it is used
Explains why hash tables need collision handling and how collisions influence lookup, insertion, and deletion performance.
How deep it goes
Defines collisions, demonstrates linked-list chaining, and connects crowding to O(n) worst-case behavior without implementing hash tables.
Examples
Uses apples, avocados, and bananas sharing alphabetic slots, plus hash-function distribution exercises involving names, battery sizes, and book titles.
What you can do after
Diagnose collision-related slowdowns by checking hash-function distribution and load factor, while relying on built-in hash-table implementations.

Read how Grokking Algorithms, Second Edition explains hash collision →

Clojure: The Essential Reference

A hash collision occurs when distinct keys produce the same hash-table index or hash value.

How it is used
Explains how hashing choices affect map keys, composite-key efficiency, and Java interoperability.
How deep it goes
Contrasts Java hashCode with Clojure hash through concrete outputs, but stops short of explaining hash-table bucket algorithms.
Examples
Uses colliding longs and composite sets, then compares Java hashCode outputs with Clojure hash outputs.
What you can do after
Evaluate key-hashing behavior and choose Clojure collection hashing when Java hashCode produces frequent collisions.

Read how Clojure: The Essential Reference explains hash collision →

High Performance Unity Game Development

A hash collision occurs when distinct keys produce the same hash value.

How it is used
Explains why dictionary keys sharing a hash require special handling during insertion and lookup.
How deep it goes
Compares free-slot searching with bucket chains and describes lookup behavior, without detailing hash generation.
Examples
Uses Zombie and Vampire keys to illustrate entries that share a bucket.
What you can do after
Evaluate how collisions can lead to linear searches or linked-chain traversal during dictionary lookup.

Read how High Performance Unity Game Development explains hash collision →

100 Java Mistakes and How to Avoid Them

How it is used
Explains why collisions and mutable collection keys can make HashSet membership checks fail.
How deep it goes
Demonstrates crafted collisions, bucket treeification, and mutation failure while stopping short of general collision algorithms.
Examples
Uses StringBuilder objects, a deliberately colliding bucket, and post-insertion mutation to expose lookup failure.
What you can do after
Diagnose/debug collection lookups by checking key mutation, hash collisions, and inconsistent equals() and compareTo() behavior.

Read how 100 Java Mistakes and How to Avoid Them explains hash collision →

Software Security for Developers

A hash collision occurs when two different inputs produce the same hash value.

How it is used
Explains why cryptographic hashes must resist attackers finding different inputs with the same output.
How deep it goes
Defines collisions and collision resistance, but defers the mathematical design and assessment of secure hash functions.
Examples
Uses SHA-256 values for lowercase and uppercase letters and a large disk image to show fixed-size outputs.
What you can do after
Evaluate hash-function choices and avoid designing custom cryptographic hash functions.

Read how Software Security for Developers explains hash collision →

Also covered in

What to know first

Related concepts

Questions about hash collision

What is hash collision?

A hash collision occurs when distinct inputs to a hash function produce the same hash value or map to the same hash-table location.

Which Manning books explain hash collision?

Algorithms Every Programmer Should Know, Grokking Algorithms, Second Edition, Clojure: The Essential Reference, High Performance Unity Game Development, 100 Java Mistakes and How to Avoid Them and Software Security for Developers.

What should I know before learning hash collision?

Manning books that teach hash collision usually introduce Map, hash function, array and constant time first.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.