[algogeeks] Deletion in Vector

2011-10-01 Thread SAMMM
Just wondering when a element in a Vector is deleted/removed , is the preceding elements r shifted left or it behave like a linked list??? For both Java and C+++ ... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Deletion in Vector

2011-10-01 Thread shady
nice question, Vector are implemented as arrays so they are shifted unlike linked list. On Sat, Oct 1, 2011 at 9:34 PM, SAMMM somnath.nit...@gmail.com wrote: Just wondering when a element in a Vector is deleted/removed , is the preceding elements r shifted left or it behave like a linked

Re: [algogeeks] Deletion in Vector

2011-10-01 Thread Hatta
yes they are shifted that's why you should use std::deque whenever that matters http://www.cplusplus.com/reference/stl/vector/erase/ Because vectors keep an array format, erasing on positions other than the vector end also moves all the elements after the segment erased to their new positions,