priority_queue Comparator、Heap 与秋招高频模型 | STL
本章覆盖:Compare 语义容易与“谁在 top”混淆;max heap;min heap;custom struct comparator;lambda comparator;heap invariant;`make_heap`;`push_heap`;`pop_heap`;adapter vs heap algorithms;Top-K complexity;面试中能解释底层 heap 而不是只会模板代码。
本章知识点
- Compare 语义容易与“谁在 top”混淆
- max heap
- min heap
- custom struct comparator
- lambda comparator
- heap invariant
make_heappush_heappop_heap- adapter vs heap algorithms
- Top-K complexity
- 面试中能解释底层 heap 而不是只会模板代码