Difference Between Vector and Deque in C++
2014-11-28 13:47
288 查看
1) Dequeue can quickly insert or delete both at the front or the end. However, vector can only quickly insert or delete at the end.
2) Memory allocation is different. A vector always occupies a contigious region of memory. If a vector goes too large, it need to be moved to a new location where it can fit. A deque,on the other hand, can be stored in several non-contigious areas; it's segmented. So a deque doesn't need to be moved if it goes too large.
2) Memory allocation is different. A vector always occupies a contigious region of memory. If a vector goes too large, it need to be moved to a new location where it can fit. A deque,on the other hand, can be stored in several non-contigious areas; it's segmented. So a deque doesn't need to be moved if it goes too large.
相关文章推荐
- What are the differences between struct and class in C++?
- What exactly is the difference between “pass by reference” in C and in C++?
- Difference between Vector and ArrayList in java?
- What are the differences between a pointer variable and a reference variable in C++?
- Difference between ArrayList and Vector in Java
- what is the difference between static and normal variables in c++
- The differences between pointer and reference in C++
- Java - Difference between ArrayList and Vector in Java
- Difference between pointer variable and reference variable in C++
- The differences between new(delete) and malloc(free) in c/c++
- Difference between ArrayList and Vector In java
- What are the differences between a pointer variable and a reference variable in C++?
- Difference Between Initialization and Assignment in C++
- Difference between event.target and event.currentTarget properties in an event object.
- Differences between Name and x:Name in XAML
- The different between Char in C#.Net and in C++.Net(MFC)
- more effective c++:the difference between pointer and reference
- What is difference between And and Andalso in VB.net ?
- [WPF]The differences between Text Box and Text Block in Blend
- difference between echo and print in php