알고리즘&자료구조/이론

[C++/g++] PBDS(Policy Based Data Structure)

Nakuri 2023. 11. 20. 01:25
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main(){
	ordered_set oSet;
	// idx 번째 iterator 반환
	oSet.find_by_order(idx);

	// value의 idx를 반환 (value보다 작은 원소 개수를 반환)
	oSet.order_of_key(value);

	oSet.insert(v);
	oSet.erase(v);
}

 
 

https://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/
https://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/tree_based_containers.html

728x90