热门

最新

红包

立Flag

投票

同城

我的

发布
frank_haha
frank_haha
4 年前
truefrank_haha

c++ 中 unordered_set 类似 python 里的set
使用hash表存储数据,插入和查询都是O(1),支持的数据类型也有限,不支持vector, 其他的,比如说string是支持的

unordered_map 类似字典
其实c++本来有set,但那个是ordered set,采用平衡检索二叉树:红黑树,也成为RB树(Red-Black Tree),查询是logN

unordered_set 基础
https://blog.csdn.net/qq_39450326/article/details/75949511
https://blog.csdn.net/fanyun_01/article/details/81275676
http://c.biancheng.net/view/7231.html

unordered_map案例
https://blog.csdn.net/yz930618/article/details/88850284

hash vector的解法
https://blog.csdn.net/dreamiond/article/details/88553332

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
夯实基础stringstream 的清空有两种方法 clear() 以及 str("") clear()成员函数继承自ios并用于清除流的错误状态,例如,如果文件流的错误状态设置为eofbit(文件结束),则调用clear()将错误状态设置回goodbit(无错误)。清除内容需要用 str("") 方法https://blog.csdn.net/chjp2046/article/details/5460462https://www.codenong.com/20731/
立即登录