[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, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
 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, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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, which may not be a method as efficient as erasing
in other kinds of sequence containers (deque, list).



On Sat, Oct 1, 2011 at 1:21 PM, shady sinv...@gmail.com wrote:
 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
 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, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Hatta

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.