![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++Cpp 语言
文章平均质量分 69
wenjie_S
这个作者很懒,什么都没留下…
展开
-
c++ list, vector, map, set 区别与用法比较
1》List 与 VectorList封装了链表,Vector封装了数组, list和vector得最主要的区别在于vector使用连续内存存储的,他支持[]运算符,而list是以链表形式实现的,不支持[]。Vector对于随机访问的速度很快,但是对于插入尤其是在头部插入元素速度很慢,在尾部插入速度很快。List对于随机访问速度慢得多,因为可能要遍历整个链表才能做到,但是对于插入就快的多了原创 2016-12-01 18:12:55 · 192 阅读 · 0 评论 -
Swap函数的实现
/*并没有交换*/ #include#include#includeusing namespace std;void sswap(int,int); int main(){ int x=3; int y=5; sswap(x,y);//int a=x; int b=y; cout<<"x="<<x<<endl<<"y="<<y<<endl; return 0;}原创 2016-10-27 15:23:56 · 528 阅读 · 0 评论