Data Structures & Algorithms · Interview question

Why does embedded code usually prefer open addressing over chaining?

A strong answer

Memory model. Chaining allocates a node per inserted key, which means malloc (fragmentation, non-determinism, the allocation problems) or maintaining a node pool, plus pointer-chasing through scattered nodes that's cache-unfriendly. Open addressing stores every key directly in one fixed, pre-allocated array: no per-key allocation, contiguous memory that's cache-friendly, and a hard, known memory bound set at compile time. For a bare-metal system that bans the heap and needs deterministic memory, a fixed power-of-two table with linear probing fits naturally, you size it for the worst-case key count plus headroom so the load factor stays low. The one discipline open addressing adds is tombstone handling for deletion. And when the key space is small and dense, you skip hashing entirely for a direct-mapped table (array indexed by key), which is O(1) worst case with no collisions at all.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

Hash Tables

O(1)-average keyed lookup by mapping keys to array slots: collisions, load factor, and why open addressing into a fixed array beats chaining when you have no heap.

More Hash Tables questions

Browse all 472 interview questions
Why does embedded code usually prefer open addressing over chaining? | EmbeddedPrep.io