Basic usage of Policy-Based Data Structure (PB_DS)
Hash Table #
Usage #
Use it like a unordered_map
.
A slightly better hash Function #
Unbeatable hash function #
Balanced BST #
Declaration #
Make a map #
Make a set #
Make a multi-set #
Alternatively, you can use std::less_equal
, but lower_bound
and upper_bound
will swap their functionality.
Beyond std::set : ranking #
Your must use tree_order_statistics_node_update
to get order statistic:
Use lower_bound and upper_bound to find precursor and successor #
Find precursor:
Find successor
Priority Queue #
Prototype #
Usage #
Just use the default parameter and you will get the best performance(must include the namespace):
All the five tags:
binary_heap_tag
binomial_heap_tag
pairing_heap_tag
thin_heap_tag
rc_binomial_heap_tag
What’s different from std::priority_queue
#
Reference #
Policy-Based Data Structure
Blowing up unordered_map, and how to stop getting hacked on it
pb_ds库的一些常用方法
用 pbds 过 luogu P3369【模板】普通平衡树