- 博客(2)
- 资源 (2)
- 收藏
- 关注
原创 c++ list, vector, map, set 区别与用法比较
1》List 与 Vector List封装了链表,Vector封装了数组, list和vector得最主要的区别在于vector使用连续内存存储的,他支持[]运算符,而list是以链表形式实现的,不支持[]。 Vector对于随机访问的速度很快,但是对于插入尤其是在头部插入元素速度很慢,在尾部插入速度很快。List对于随机访问速度慢得多,因为可能要遍历整个链表才能做到,但是对于插入就快的多了
2016-12-01 18:12:55
236
原创 Swap函数的实现
/*并没有交换 */ #include #include #include using 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
621
Swap函数的实现
2016-10-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅