↓Skip to main content

Lazy-Deletion

Queue and Design Problems
·3 mins
Algorithm Queue Design Iterator Lazy-Deletion
Circular queues, zigzag iterators, FIFO matching with cancellation, and the data structure combinations that design problems keep using
LeetCode 716: Max Stack
·3 mins
LeetCode Hard Stack Heap Design Lazy-Deletion
LeetCode 716 note: store unique ids on both the stack and the heap, record deletions by id, and discard deleted entries lazily; tracking values cannot tell duplicates apart
LeetCode 3885: Design Event Manager
·2 mins
LeetCode Medium Heap Design Hash-Map Lazy-Deletion
LeetCode 3885 note: a dict of current priorities plus a max-heap with lazy deletion, validated on pop
LeetCode 3829: Design Ride Sharing System
·2 mins
LeetCode Medium Queue Design Hash-Map Lazy-Deletion
LeetCode 3829 note: one queue each for riders and drivers; cancellations only update a set, and canceled riders at the front are dropped before matching
LeetCode 3815: Design Auction System
·3 mins
LeetCode Medium Heap Design Hash-Map Lazy-Deletion
LeetCode 3815 note: one max-heap per item, push a new entry on every bid change, and drop stale entries on query
LeetCode 3607: Power Grid Maintenance
·3 mins
LeetCode Medium Heap Union-Find Graph Lazy-Deletion
LeetCode 3607 note: Union-Find groups, one min-heap per group, and lazy deletion for offline stations