哈希表 STL map
2024-10-21 13:29:57
计数排序时我们使用一个数组来记录出现的数字的次数,而当数据范围太大时,无法建立一个那么大地数组(而且可能空间利用率很低,太浪费),此时可以改用hash table 、 binary search tree等数据结构作为lookup table
#include<cstdio>
#include<map>
#include <iostream>
using namespace std;
int main(){
map<int,int> b;
map<int,int>::iterator i;
int a[]={
,,,,,,,,,
};
for(int i=;i<;i++){
b[a[i]]++;
}
for(i=b.begin();i!=b.end();i++){
cout<<i->first<<' '<<i->second<<"\n";
}
}
最新文章
- php报错 ---->; Call to undefined function imagecreatetruecolor()
- Python调用服务接口
- Tomcat启动服务报错:Unknown version string [3.1]. Default version will be used.
- POJ 1106 Transmitters(计算几何)
- 安装LNMP之后出现 Access denied.解决方法
- (整理)SQLServer_DBA 工具
- oracle 中文乱码---查看和修改客户端字符集
- Vertica笔记
- markdownpad2使用说明
- hdu 1288 Hat&#39;s Tea
- iOS11和机器学习CoreML库
- thinphp原生异步分页
- 【并查集】HDU 1325 Is It A Tree?
- InnoDB一棵B+树可以存放多少行数据?
- Linux mint界面过小无法安装(解决方法)
- eBay账号token授权
- Linux 文本处理工具记录
- java 的基本数据类型及转换
- 数据结构图解(递归,二分,AVL,红黑树,伸展树,哈希表,字典树,B树,B+树)
- ujquery.fancybox api开发文档中文翻译版
热门文章
- Spring的扩展
- Redis集群进阶之路
- 安装Flutter环境
- Codeforces Round #482 (Div. 2) : Kuro and GCD and XOR and SUM (寻找最大异或值)
- 22-Consent 确认逻辑实现
- BZOJ1222_ 产品加工_KEY
- == vs === in Javascript
- Ruby基础教程 1-10
- 「日常训练」Kefa and Dishes(Codeforces Round #321 Div. 2 D)
- Linux命令应用大词典-第32章 性能监控