Hash Tables
Descripción
Demonstrates hash tables by animating the hash function that maps a key to a bucket index, inserting multiple key-value pairs, performing a lookup, and resolving a collision using chaining.
Hash Tables
Description
Demonstrates hash tables by animating the hash function that maps a key to a bucket index, inserting multiple key-value pairs, performing a lookup, and resolving a collision using chaining.
Phases
| # | Phase Name | Duration | Description |
|---|---|---|---|
| 1 | Title Card | 3s | Title fades in |
| 2 | Key-Value Concept | 4s | Show "name" → "Alice" as a key-value pair |
| 3 | Hash Function | 6s | Animate "name" → hash() → bucket index 3 |
| 4 | Hash Table Array | 3s | Show the bucket array (8 slots) |
| 5 | Insert 3 pairs | 10s | Insert ("name","Alice"), ("age","25"), ("city","NYC") |
| 6 | Lookup | 6s | Lookup "age" → hash → bucket 5 → "25" found |
| 7 | Collision | 7s | Two keys hash to same bucket; chaining shown |
| 8 | Key Properties | 4s | O(1) avg insert/lookup, hash function deterministic |
| 9 | Outro | 2s | Fade out |
Layout
+------------------------------------------------------+
| Hash Tables |
+------------------------------------------------------+
| |
| key="name" ──> [hash()] ──> index=3 |
| |
| BUCKET ARRAY: |
| [0] → None |
| [1] → None |
| [2] → None |
| [3] → ("name", "Alice") |
| [4] → None |
| [5] → ("age", 25) |
| [6] → ("city", "NYC") |
| [7] → None |
| |
| Collision: [3] → ("name","Alice") → ("job","Dev") |
+------------------------------------------------------+
Area Descriptions
- Top: Title
- Left: Hash function box with key input and index output
- Center/Right: Bucket array with chained entries
- Bottom: Properties summary
Assets & Dependencies
- Fonts: LaTeX / sans-serif
- Manim version: ManimCE 0.19.1
Notes
- Hash function box has gear-style border in cyan
- Keys are shown in quotes with neon green
- Bucket slots are small rectangles; filled slots have cyan content
- Collision chain uses arrow links between entries in same bucket
- Lookup path highlighted with orange arrows
Audiencia: High SchoolCategoría: Cs