On this page
Linear & Hashed Structures
Prev: Complexity & Big-O Notation | Up: algorithms_and_dsa | Next: Trees, Heaps & Graphs
Rel: Python Built-in Data Structures, JS Map & Set
Ref: Wikipedia — Hash Table
Tags: #public #prog #programming #dsa
Contents
Arrays, Linked Lists, Stacks & Queues
| Structure | Index Access | Insert/Delete End | Insert/Delete Front | Memory Layout |
|---|---|---|---|---|
| Dynamic Array | $O(1)$ | $O(1)$ amortized | $O(n)$ | Contiguous (cache-friendly) |
| Linked List | $O(n)$ | $O(1)$ (with tail) | $O(1)$ | Scattered heap nodes |
| Ring Buffer / Deque | $O(1)$ | $O(1)$ amortized | $O(1)$ amortized | Contiguous circular buffer |
- Stack (LIFO): push/pop from one end (call stack, undo history, DFS, bracket matching).
- Queue (FIFO): enqueue at back, dequeue at front (task scheduling, BFS, producer-consumer buffers).
Hash Tables & Collision Resolution
A hash table maps keys via hash(key) % capacity to bucket slots for $O(1)$ average lookup, insert, and delete:
- Separate chaining: each bucket holds a small list/tree of colliding entries.
- Open addressing (linear/quadratic probing, Robin Hood hashing): stores entries directly in a contiguous array for superior CPU cache performance.
- Resizes (rehashes) when load factor exceeds a threshold (~0.7).
Linked from
Related notes
- tuts/programming/algorithms_and_dsa Linked here; links to this page; shared tags: #dsa, #prog, #programming
- tuts/programming/algorithms_and_dsa/trees_heaps_and_graphs Linked here; links to this page; shared tags: #dsa, #prog, #programming
- tuts/programming/algorithms_and_dsa/complexity_and_big_o Linked here; links to this page; shared tags: #prog, #programming
- tuts/c/tutorials/dynamic_array_implementation links to this page; shared tags: #dsa, #prog
- tuts/c/tutorials/hash_table_from_scratch links to this page; shared tags: #dsa, #prog
- tuts/javascript/builtins/collections_map_set_weak Linked here
- tuts/python3/tutorials/core_fundamentals/builtin_data_structures Linked here
- tuts/programming shared tags: #prog, #programming
- tuts/programming/algorithms_and_dsa/problem_solving_patterns shared tags: #prog, #programming
- tuts/programming/concurrency shared tags: #prog, #programming