pd_ds中的hash

前言

在c++的STL中,提供了一种hash函数,其用法和map是几乎同样的,可是速度却能快接近一倍c++

使用方法

须要的头文件函数

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;

函数声明方式spa

cc_hash_table<int,bool>h;
gp_hash_table<int,bool>h;

cc_hash_table是拉链法code

gp_hash_table是查探法blog

查探法要快一些,我的推荐用查探法。hash

 

实测

相关文章
相关标签/搜索