Home/Algo Bridge/O(1) Insert Delete GetRandom (Array + Map)/LC_380
⚡ Practice in Flashcards
🌉 Problem-Level AI BridgeLC_380 · 中等

LC_380 (Insert Delete Getrandom O1) ➔ PagedAttention: Virtual Memory Block Table Mapping

Algorithmic foundation connecting classic data structures to LLM high-performance computing.

1️⃣ 1️⃣ Classical DSA Origin

LC_380 · Insert Delete Getrandom O1

Pattern: O(1) Insert Delete GetRandom (Array + Map) — Dual architecture pairing a dynamic array with a hash map. The array guarantees contiguous memory and O(1) uniform random access; the map indexes values to array slots. Deletions swap the target with the last element before popping, achieving O(1) across all operations.

⚡ Open LC-380 Solution ➔
2️⃣ 2️⃣ Production AI System Transfer

vLLM PagedAttention & Block-Paged KV Cache · PagedAttention: Virtual Memory Block Table Mapping

Industrial Application: Industrial optimization for modern large model training and inference pipelines.

🧬 Target AI Kernel Interface
def paged_attention(Q: torch.Tensor, K_cache: torch.Tensor, V_cache: torch.Tensor, block_tables: torch.Tensor, context_lens: torch.Tensor, block_size: int = 16) -> torch.Tensor

🔗 Related Algorithmic Bridges

LC_239 ➔ PagedAttention: Virtual Memory Block Table Mapping
Algorithmic foundation connecting classic data structures to LLM high-pe...
LC_146 ➔ PagedAttention: Virtual Memory Block Table Mapping
Doubly linked list paired with hash table guarantees O(1) eviction and l...
LC_460 ➔ PagedAttention: Virtual Memory Block Table Mapping
Algorithmic foundation connecting classic data structures to LLM high-pe...
← LC_460 (LFU Cache) → vLLM PagedAttention & Block-Paged KV CacheLC_124 (Binary Tree Maximum Path Sum) → MCTS Reasoning, Tree-of-Thoughts & Backtracking for LLMs →