i) vector = A non synced data structure good for random access and bad
for insertions,deletions and sequential scans.
ii) Singly linked list = Bad for random access, good for one way
sequential access, good for insertions in the middle.
iii) Doubly linked list = Bad for random access, best for
I am sorry, vectors are synced and hence slow (concurrency overhead,
arraylists are non synced). Rest remain the same, if your application
demands frequent two way sequential scans, go for DLL.
Pralay Biswas
MS-CS, University of California Irvine
On Wed, Nov 21, 2012 at 6:57 AM, Pralay Biswas
i would rather suggest vector for FAST SEQUENTIAL ACCESS
as Vector contain elements in contiguous memory locations...so cache
locality is good in case of it
as in case of Singly Linked List or Doubly Linked List,, cached locality is
not good,, Sequntial access would not be fast in a long run..
@Pralay.. can u give a more detail about non synced data structure
--
Also, vectors are not contiguously memory slotted always. Its a expanding
array where the resizing takes place on demand. There are times when the
array backing the vector is resized and re-allocated, but even then the
amortized cost of insertion stays linear (O(n)). Although it makes sense
to
assume there are no additional insertions, so we care about only accessing
an element.
On Sat, Nov 24, 2012 at 12:30 AM, Pralay Biswas
pralaybiswas2...@gmail.comwrote:
non synced data structure = not thread safe in most prog languages!
On Fri, Nov 23, 2012 at 9:00 AM, Atul Singh
The answer should be a vector because it uses an array to store the
elements internally and
since an array consists of contiguous memory locations, sequential access
will be the fastest.
In contrast to SLL or a DLL, the nodes may be at random memory locations
and will not provide
the fastest
which data structure among the follow has fastest sequential access ?
i) vector
ii) Singly linked list
iii) Doubly linked list
it won't be doubly linked list as it involves more pointer manipulations
than singly linked list...
--
singly linked list
On Wed, Nov 21, 2012 at 8:21 PM, shady sinv...@gmail.com wrote:
which data structure among the follow has fastest sequential access ?
i) vector
ii) Singly linked list
iii) Doubly linked list
it won't be doubly linked list as it involves more pointer manipulations
@shady : as subject says fastest sequential access , then if i am not
getting it wrong.we only care of sequential access a value not modifying
the linked list.
so i guess double linked list would be helpful
1) bcozz it can move in both the direction , so if linked list is sorted
then it would be
10 matches
Mail list logo