STL
呆呆与笨笨
梦想是被追逐的,而不是幻想的
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
STL:sort()用法
I)Sort函数包含在头文件为#include algorithm 的c++标准库中II)Sort函数有三个参数:(1)第一个是要排序的数组的起始地址。(2)第二个是结束的地址(最后一位要排序的地址)(3)第三个参数是排序的方法,可以是从大到小也可是从小到大,还可以不写第三个参数,此时默认的排序方法是从小到大排序。Sort函数使用模板:Sort(start,end,排序方法)下面就具体使用sort(转载 2015-03-15 10:58:35 · 647 阅读 · 0 评论 -
全排列递归算法与STL:next_permutation()函数
设计一个程序生成n个元素{r1,r2,…,rn}的全排列。如n=3时,输出为:r1r2r3,r3r2r1,r1r3r2,r2r1r3,r2r3r1,r3r1r2。 思路如下: 全排列是将一组数按一定顺序进行排列,如果这组数有n个,那么全排列数为n!个。现以{1, 2, 3, 4, 5}为例说明如何编写全排列的递归算法。 1、首先看最后两个数4, 5。 它们的全排列为4 5和5 4, 即以4开头转载 2015-03-14 21:29:46 · 537 阅读 · 0 评论 -
查找学生信息(map使用)
#include<iostream> #include<cstdio> #include<string> #include<map> using namespace std; int main() { int n,m; string s,id; map<string,string> mymap; map<string,string>::iterator it;原创 2015-03-27 11:05:32 · 473 阅读 · 0 评论 -
查找学生信息(map使用)
#include<iostream> #include<cstdio> #include<string> #include<map> using namespace std; int main() { int n,m; string s,id; map<string,string> mymap; map<string,string>::iterator it;原创 2015-03-27 11:08:35 · 644 阅读 · 0 评论
分享